qq_27128171 2018-11-21 13:06 采纳率: 0%
浏览 1986
已结题

spring boot 访问报错

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Nov 21 21:00:12 GMT+08:00 2018
There was an unexpected error (type=Not Found, status=404).
No message available!
图片说明

#Tomcat
server:
tomcat:
uri-encoding: UTF-8
max-threads: 1000
min-spare-threads: 30
port: 8081
#mysql
spring:
profiles:
active: dev
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
datasource:
driver-class-name: com.mysql.jdbc.Driver
druid:
initial-size: 3
min-idle: 3
max-active: 10
max-wait: 60000
validation-query: SELECT 1
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
use-global-data-source-stat: true
min-evictable-idle-time-millis: 300000
time-between-eviction-runs-millis: 60000
max-open-prepared-statements: 20
max-pool-prepared-statement-per-connection-size: 20
slf4j:
enabled: true
wall:
enabled: true
web-stat:
enabled: true
url-patterns: '/*'
exclusions: '*.gif,*.jpg,*.jpeg,*.png,*.bmp,*.swf,*.ico,*.woff,*.woff2,*.ttf,*.eot,*.js,*.css,*.html,*.htm,/druid/*'
stat-view-servlet:
enabled: true
url-mappings: '/druid/*'
allow: 127.0.0.1
deny: 192.168.2.1
login-username: admin
login-password: 123456
reset-enable: false
freemarker:
request-context-attribute: req #req访问request
suffix: .html #后缀名
content-type: text/html
enabled: true
cache: false #缓存配置
template-loader-path: classpath:/static/templates/ #模板加载路径 按需配置
charset: UTF-8 #编码格式
返回是json 格式的,能提示这么错误么?

@RestController
public class TestController {
@Autowired
private ICityPyService cityPyService;

@RequestMapping(value = "/",method = RequestMethod.GET)
public String test(){
CityPy city = cityPyService.queryCityPyById(1L);
return "webapp start..";
}
}

请求地址:http://127.0.0.1:8080/

    ![图片说明](https://img-ask.csdn.net/upload/201811/21/1542806010_583411.png)
  • 写回答

2条回答 默认 最新

  • 青蛙与大鹅 2018-11-21 13:11
    关注

    看你的路径配置是/static/templates/ 后缀名是.html,上面的报错提示是404页面没有找到页面。看下自己的路径吧,应该是路径写的不对

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100