我是否需要webstarter才能仅使用RestController注释?

时间:2018-07-27 21:03:26

标签: spring-boot spring-restcontroller spring-boot-starter

我在网络上看到了一个Spring Boot网络启动程序示例,其中包括仅使用Restcontroller注释的启动程序,但是我正在做小型POC,我可以看到我不需要它……我缺少了一些东西或在我看到的这个示例中,添加首发确实确实是一个过大的杀伤力?

2 个答案:

答案 0 :(得分:0)

为了在PoC中使用@RestController,必须在类路径中包含spring-boot-starter-web工件。

答案 1 :(得分:0)

您不能,spring-boot-starter-web不仅包含@RestController批注,还包含tomcat Spring Boot Web应用程序的其他必要配置。
看看Spring Boot documentation

相关问题