Spring 6.0.1 or spring boot 3 automatic assembly problem spring.factoriess does not take effect

Starting from spring 6.0.1 or spring boot 3, spring's automatic assembly is no longer available

spring.factories file

like:

 

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.example.etcdspringcloudstarter.config.EtcdAutoConfiguration

this is invalid 

Either use @Import on the startup class

Otherwise, replace it with

Spring Boot 2.7 is the last version that is still compatible with using spring.factories, SpringBoot 3 is no longer compatible, at this time you should use META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.importsfile replacement.

You can directly write the loaded class in the file without adding EnableAutoConfiguration and the like

 

Guess you like

Origin blog.csdn.net/wdd668/article/details/130982556