Skip to content

Instantly share code, notes, and snippets.

@bastman
Created November 21, 2019 15:10
Show Gist options
  • Save bastman/95a56937dbf34fee5a4453c1c5e43b98 to your computer and use it in GitHub Desktop.
Save bastman/95a56937dbf34fee5a4453c1c5e43b98 to your computer and use it in GitHub Desktop.
spring-kotlin: custom annotations example
/**
* Annotations: @RestApiQueryHandler, @RestApiMutationHandler
* as specialization of @Component
* see: @Service for impl.
*
*/
import org.springframework.core.annotation.AliasFor
import org.springframework.stereotype.Component
@kotlin.annotation.Target(AnnotationTarget.CLASS)
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
@Component
annotation class RestApiQueryHandler(
@get: AliasFor(annotation = Component::class)
val value: String = ""
)
@kotlin.annotation.Target(AnnotationTarget.CLASS)
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
@Component
annotation class RestApiMutationHandler(
@get: AliasFor(annotation = Component::class)
val value: String = ""
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment