惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
C
Cisco Blogs
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Scott Helme
Scott Helme
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
L
LINUX DO - 热门话题
I
InfoQ
GbyAI
GbyAI
NISL@THU
NISL@THU
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Engineering at Meta
Engineering at Meta
H
Hackread – Cybersecurity News, Data Breaches, AI and More
TaoSecurity Blog
TaoSecurity Blog
Simon Willison's Weblog
Simon Willison's Weblog
A
About on SuperTechFans
Spread Privacy
Spread Privacy
月光博客
月光博客
W
WeLiveSecurity
AWS News Blog
AWS News Blog
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
Security Latest
Security Latest
人人都是产品经理
人人都是产品经理
PCI Perspectives
PCI Perspectives
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
T
Troy Hunt's Blog
Martin Fowler
Martin Fowler
The Hacker News
The Hacker News
T
Tor Project blog
C
CERT Recently Published Vulnerability Notes
Apple Machine Learning Research
Apple Machine Learning Research
Stack Overflow Blog
Stack Overflow Blog
K
Kaspersky official blog
Cloudbric
Cloudbric
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
D
DataBreaches.Net
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tenable Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - Franky
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog

博客园 - 果然如此

微信小程序UI组件、开发框架、实用库 sql查询优化--数字转换字符串字段 Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad Git简易的命令行入门教程 .NET Framework 历史版本(2017年) 深入理解 JavaScript 事件循环(一)— event loop spring boot maven多模块打包部署到tomcat TypeScript白鹭引擎Egret防止按钮事件冒泡穿透 maven多模块启动required a bean of type com.xxx.xxx.service that could not be found. idea常用快捷键 启动类加注解@MapperScan spring boot mybatis 启动错误 Maven项目mybatis Invalid bound statement (not found)解决方法 Re:从零开始的Spring Security Oauth2(三) Re:从零开始的Spring Security Oauth2(二) Re:从零开始的Spring Security Oauth2(一) typescript多维对象数组仿List泛型 TypeScript 基本语法 idea新建maven项目没有src目录 《乔布斯传》经典摘录(七)
spring boot 错误:Check your ViewResolver setup
果然如此 · 2018-03-23 · via 博客园 - 果然如此

Whitelabel Error Page

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

Fri Mar 23 10:34:26 CST 2018
There was an unexpected error (type=Internal Server Error, status=500).
Circular view path [index]: would dispatch back to the current handler URL [/home/index] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

解决办法:

方法1.在请求方法上加注解:@ResponseBody,无需模板文件

@RequestMapping("/home")
@Controller()
public class HomeController {
    @ResponseBody
    @RequestMapping("/index")
    public String index() {
        return "index";
    }
}

方法2. 用thymeleaf模板
在pom.xml的dependencies元素内加静态模板依赖
    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>

在resources/templates/创建html模板文件,文件名与请求方法return的字符串一样,扩展名html: index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p th:text="${data}"></p>
</body>
</html>
@RequestMapping("/home")
@Controller()
public class HomeController {
    @RequestMapping("/index")
    public String index(HashMap<String,Object> map) {
        map.put("data","index.html");
        return "index";
    }
}