简体   繁体   中英

Can't use annotation from spring boot starter

I've made a spring boot starter with annotation class, bean post processor and config class. After mvn install I add this starter as a dependency to another project. Starter appears in external libs and IntelliJ can even autocomplete my custom annotation name, but it can't import it. As from I read, the problem is that you can't access classes from BOOT-INF package of a jar, but I don't understand how can you write a starter then. 配置类

pom.xml

启动罐结构

You've written your project to be a Spring Boot application. Spring Boot starters shouldn't be applications though, they should be simple JAR files like any other library, plus perhaps some configuration files like META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports (which has replaced META-INF/spring.factories in Spring Boot 2.7).

You probably only need to remove the Spring Boot plugin from your project, and the result will no longer contain a BOOT-INF folder or the Spring Boot specific stuff, just your classes and resources (which may include META-INF/spring.factories of course).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM