- 添加Maven依赖
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.6</version> </parent> <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> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
- 编写启动类
@SpringBootApplication public class PublisherApplication { public static void main(String[] args) { SpringApplication.run(PublisherApplication.class); } }
- 编写测试类
@RunWith(SpringRunner.class) @SpringBootTest(classes = PublisherApplication.class) public class PublisherTest { @Test public void test(){ } }
普通的maven项目改造成SpringBoot项目
最新推荐文章于 2024-01-16 21:13:27 发布
关键词由CSDN通过智能技术生成