原文:springboot项目启动,但是访问报404错误

启动类Application上加了 ComponentScan basePackages 这个注解导致controller扫描不到导致的,如果加了这个注解,springboot就不会扫描Application所在的包及子包的文件,需要将controller所在的包加入到注解 ComponentScan的大括号中 ...

2019-07-11 17:48 0 2709 推荐指数:

查看详情

SpringBoot正常启动访问项目404的解决方案。

首先需要检查: 启动类是否放在所有包的父目录; 或者启动类增加注解@ComponentScan(basePackages={"com.demo.test.*"}) 其次: 在Controller中,使用@RestController注解; 或者使用@Controller注解类,并且使用 ...

Wed Aug 05 23:44:00 CST 2020 0 1681
SpringCloud正常启动但是访问404错误

一、spring boot的启动类不能直接放在main(src.java.main)这个包下面,把它放在有包的里面就可以了。 二、正常启动了,但是我写了一个controller ,用的@RestController 注解去配置的controller,然后路径也搭好了,但是浏览器一直404.最后 ...

Thu Sep 12 23:01:00 CST 2019 0 682
springboot启动正常,访问restController404

原因:spring boot只会扫描启动类当前包和以下的包 比如以下: 主类:Application放在包com.springboot.main controller类放在包com.springboot.controller 上面这处情况是找不到controller的 正确的做法 ...

Fri May 19 21:55:00 CST 2017 0 1256
eclipse下启动tomcat访问网址404错误

,则保存修改后重新启动tomcat,检查是否解决问题 如果上面的内容不能修改,显示灰色,则继续接下来的操 ...

Sat Jan 12 00:42:00 CST 2019 0 613
web项目启动首页能访问接口404

这个问题坑了我好半天,很简单的事一下子就解决了! 这种问题一般是资源没有加载导致的,接口无法访问 ...

Mon Oct 08 19:35:00 CST 2018 0 1120
 
粤ICP备18138465号  © 2018-2026 CODEPRJ.COM