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 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块