将maven项目改造成springboot项目

421 阅读1分钟
  1. pom.xml配置之springboot
    1.1 继承springboot父项目依赖
<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.0</version>
        <relativePath/> <!-- lookup parent from repository -->
</parent>

1.2  插件依赖

 <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>

</dependencies>
  1. 启动类配置
@SpringBootApplication
public class SquareApplication {
    public static void main(String[] args) {
        SpringApplication.run(SquareApplication.class,args);
    }
}
  1. application.yml