【发布时间】:2017-07-08 22:10:45
【问题描述】:
我第一次尝试使用 Spring Boot 显示 Freemarker 视图,目前在浏览器中出现以下错误:
白标错误页面
这个应用程序没有明确的 /error 映射,所以你看到 这是一个后备。
2017 年 2 月 19 日星期日 17:59:07 GMT 出现意外错误(type=Not 找到,状态=404)。没有可用的消息
我使用的是 Spring Boot 1.5。
我的文件结构:
登录控制器
package com.crm.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.crm.service.LoginService;
@Controller
public class LoginController {
@Autowired
private LoginService loginService;
@RequestMapping("/login")
public String authenticate() {
return "loginPage";
}
}
application.properties
spring.freemarker.template-loader-path: /
spring.freemarker.suffix: .ftl
服务器
package com.crm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Server{
public static void main(String[] args) {
SpringApplication.run(Server.class, args);
}
}
为什么 Spring 无法解析 loginPage.ftl 视图?为什么我在网络浏览器中看不到?
【问题讨论】:
标签: java spring spring-mvc spring-boot freemarker