qq_27128171
qq_27128171
采纳率0%
2018-11-21 13:06 阅读 1.9k

spring boot 访问报错

5

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条回答 默认 最新

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

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

    点赞 评论 复制链接分享
  • qq_27128171 qq_27128171 2018-11-21 13:15

    问题已经解决,@RestController 返回路径,不能返回json ,还得学习一下

    点赞 评论 复制链接分享

相关推荐