Giter VIP home page Giter VIP logo

Comments (8)

0x3333 avatar 0x3333 commented on August 20, 2024

Hi, the src/test are the tests, the source code itself is on src/main.

To use the project, you need to package and install on your local maven repo.

git clone [email protected]:0x3333/dagger-aop-logger.git
cd dagger-aop-logger
mvn clean install

And import into your project:

  <dependency>
      <groupId>com.github.0x3333.dagger.aop</groupId>
      <artifactId>dagger-aop-logger</artifactId>
      <version>1.0-SNAPSHOT</version>
  </dependency>

Then you are ready to go.

from dagger-aop-logger.

darthShana avatar darthShana commented on August 20, 2024

but what about this step
"Add to you Dagger Module the InterceptorModule and a @provides for LogInterceptor."

from dagger-aop-logger.

0x3333 avatar 0x3333 commented on August 20, 2024

To YOUR Dagger Module you add:

 @Provides
  static LogInterceptor providesLogInterceptor() {
    return new LogInterceptor();
  }

This will bind the LogInterceptor class in the dagger graph.

from dagger-aop-logger.

darthShana avatar darthShana commented on August 20, 2024

hmm. ok but as per your documentation
`// Adding InterceptorModule
@module(includes = { InterceptorModule.class })
public abstract class MyModule {

@BINDS
MyService providesMyService(MyClass impl);

@provides
static LogInterceptor providesLogInterceptor() {
return new LogInterceptor();
}

}`

So do i need ?
@Binds MyService providesMyService(MyClass impl);

from dagger-aop-logger.

0x3333 avatar 0x3333 commented on August 20, 2024

It is exactly what it says. This is a "imaginary" module. You have to add InterceptorModule and the provides in your module.

// Adding InterceptorModule
@module(includes = { InterceptorModule.class })
public abstract class MyModule {

@provides
static LogInterceptor providesLogInterceptor() {
return new LogInterceptor();
}

}

from dagger-aop-logger.

darthShana avatar darthShana commented on August 20, 2024

Im so sorry if these are dumb questions but if
public abstract class MyModule {
is the module in "my project"
it would be in
src/main/java/com.dathShana.sample.modules/MyModule.java
How can i add a dependancy on InterceptorModule.class which gets generated in
src/test/....

thank you for your responses

from dagger-aop-logger.

0x3333 avatar 0x3333 commented on August 20, 2024

The src/test InterceptorModule is the module generated by the APT to the test package, APT should generate a InterceptorModule for you binds.

The InterceptorModule is a module that is generated with binds to all generated classes.

from dagger-aop-logger.

0x3333 avatar 0x3333 commented on August 20, 2024

The minimal setup example is the test itself...

from dagger-aop-logger.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.