dar*_*urf 0 java spring spring-mvc spring-boot
我有一个 Spring Boot 应用程序设置为 REST api。我现在还希望能够向客户端提供简单的 HTML 页面,而无需在任何模板引擎(如 Thymeleaf)上使用。我希望对 HTML 页面的访问属于 Spring Security 设置的相同安全约束,使用WebSecurityConfigurerAdapter, 已经存在于我的应用程序中。
我试过的是有一个Controller:
@Controller
public class HtmlPageController {
@RequestMapping(value = "/some/path/test", method = RequestMethod.GET)
public String getTestPage() {
return "test.html";
}
}
Run Code Online (Sandbox Code Playgroud)
并将test.html文件放在/resources/test.html或 中/webapp/WEB-INF/test.html。
每次我尝试访问该页面localhost:8080/some/path/test一个404返回。
我如何使这项工作?
| 归档时间: |
|
| 查看次数: |
18818 次 |
| 最近记录: |