为了账号安全,请及时绑定邮箱和手机立即绑定

加入spring-boot-starter-web的话@Configuration路由无法生效

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.BUILD-SNAPSHOT</version>
</parent>
<repositories>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>https://repo.spring.io/libs-snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

之前我没有加入spring-boot-starter-web依赖的时候

https://img1.sycdn.imooc.com//5aea85e600017c3d08910220.jpg

是可以访问到

https://img1.sycdn.imooc.com//5aea861c0001fe4608410213.jpg

这个路由的

但是加上

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

这个依赖之后

https://img1.sycdn.imooc.com//5aea866c00015edf08570282.jpg

就没有@Configuration配置的路由了,也访问不到,只能访问到@RestController

这是版本的问题吗?还是我哪里配置错了

正在回答

3 回答

同问,为什么Tomcat不行

0 回复 有任何疑惑可以回复我~

使用spring-boot-starter-web模块后,默认使用Netty容器吧

0 回复 有任何疑惑可以回复我~

使用spring-boot-starter-web模块后,默认使用了tomcat容器

0 回复 有任何疑惑可以回复我~
#1

成佛的小兔几 提问者

问题是Tomcat为什么不行
2018-05-29 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

加入spring-boot-starter-web的话@Configuration路由无法生效

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号