Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status Codacy Badge codebeat badge Maven Site Maven Central codecov

About AptSpring

This project checks that spring beans in your project adhere to certain properties when you add the @Verified annotation to your @Component or @Bean lite class.

Duplicate bean name and cycle free

Some of those properties include all beans being explicitly named, all names are unique, and all autowiring includes names via @Qualified annotations. Cycles are prevented as well as duplicate bean names.

Type Safety

Return types of @Bean methods are verified against @Autowired injection points.

Disallows "Interesting" practices

No autowiring in to @Bean lite instances. No non literal static member variables on @Bean lite instances. No autowiring an unknown list of instances by type... instead encourages the construction of named lists. No @ComponentScan, instead use @Import to allow the annotation processor to analyze your graph.


By defining the spring graph in a type safe and introspectable manner the relevant parts of a spring graph are encoded in the java type system. Your code will be more readable, more refactorable, and less error prone even if your app has to scale to thousands of beans.

Quick Start: Get the goodness.

In your pom file, include the version of spring you wish to use (3+ should be fine)

Include these dependency:


Include this takari-lifecycle configuration if you are using takari -- hint: you should be, though gradel claims incremental apt support now as well.


Include the @Verified annotation on your spring classes with @Bean methods.

Use the takari lifecycle and takari-m2e support for best performance and file handling. You can also configure the APT manually in eclipse if you are not using m2e, but eclipse's default APT handling will not support referencing a @Bean lite class in another eclipse project/maven module. You would be limited to having on one eclipse project.

The error messages will help clean up your code and keep it clean.

A full list of checks can be found on the javadoc of the @Verified annotation class.

In short, no cycles, fully defined decoupled spring graphs, with clear entry point for all system properties.

No guarantee you wont have runtime problems.

The guarantee is that those problems will be a lot simpler than the one you would otherwise get out of spring.


Please see @Verified Annotation for a full list of the constraints the AptSpringProcessor enforces, and what it may enforce in the future.

You can’t perform that action at this time.