1.创建maven项目File-》New-》Project-》
注意:
2.添加springboot依赖,及需要的其他依赖
org.springframework.boot spring-boot-starter2.3.0.RELEASE org.springframework.boot spring-boot-starter-web2.3.0.RELEASE
3.添加spring.factories文件
@Configuration
public class UserAutoConfig {
@Bean
public UserTest userTest() {
return new UserTest();
}
}
public class UserTest {
public UserTest() {
System.out.println("UserTest.............");
}
}
完成配置后
4.install到本地,之后即可在其他项目引入该依赖,完成自动配置



