1.创建maven项目File-》New-》Project-》
注意:<packaging>jar</packaging>
2.添加springboot依赖,及需要的其他依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.3.0.RELEASE</version>
</dependency>
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到本地,之后即可在其他项目引入该依赖,完成自动配置