Skip to content

dagger2,querydsl kotlin 1.7.x annotation processor, gradle 7.x

Notifications You must be signed in to change notification settings

griffio/dagger2-kotlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dagger2-example with Kotlin (1.7.x) kapt annotation processor supported Gradle build

kapt documentation

kapt-annotation-processing-for-kotlin

better-annotation-processing-supporting-stubs-in-kapt

Implement Annotation Processing API (JSR 269) natively in Kotlin

Use javac annotation processing implementation, generate AST stubs for Kotlin classes

Dagger2 site

Notes:-

  • @Component
    • @Module
      • @Provides

Shows Planets being injected via constructor by qualifier

public class TerrestrialPlanets @Inject (@Named("Mercury") val mercury: Planet,
                                         @Named("Venus") val venus: Planet,
                                         @Named("Earth") val earth: Planet,
                                         @Named("Mars") val mars: Planet) {
}

The TerrestrialPlanetsModule, for example, provides a singleton named "Mercury" etc.

@Module
public class TerrestrialPlanetsModule {

    @Provides @Singleton @Named("Mercury")
    public fun first() : Planet {
        return Mercury()
    }

    @Provides @Singleton @Named("Venus")
    public fun second() : Planet {
        return Venus()
    }

    @Provides @Singleton @Named("Earth")
    public fun third() : Planet {
        return Earth()
    }

    @Provides @Singleton @Named("Mars")
    public fun fourth() : Planet {
        return Mars()
    }

}
  • Outer Planets module
    • Jupiter
    • Saturn
    • Uranus
    • Neptune

Gradle build

./gradlew run
./gradlew test

About

dagger2,querydsl kotlin 1.7.x annotation processor, gradle 7.x

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages