properties org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.example.library.CustomAutoConfiguration @SupportedAnnotationTypes("org.springframework.boot.autoconfigure.EnableAutoConfiguration") public class CustomAutoConfigurationProcessor extends AbstractProcessor { @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { for (TypeElement annotation : annotations) { Set<? extends Element> annotatedElements = roundEnv.getElementsAnnotatedWith(annotation); for (Element annotatedElement : annotatedElements) { // ... } } return true; } } <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure-processor</artifactId> <version>2.5.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> <configuration> <classifier>exec</classifier> </configuration> </execution> </executions> </plugin> </plugins> </build>


上一篇:
下一篇:
切换中文