所以这是我的第一个带有spring boot和Gradle的web项目,我已经完成了与spring boot开始时提到的相同的步骤。即使构建过程正常并且依赖关系似乎也可以,但是每当我调用controller / firstapp时,我都会得到一个空视图,即使我尝试返回一个字符串,我也有一个Whitelabel错误页面。这是我的项目。
项目目录图片:
测试控制器:
主要课程:
application.properties :
build.gradle:
尝试使用spring.mvc.view.suffix属性中的* .html而不是.html
问题是由于我的目录配置错误,spring-boot无法从application.properties读取Viewresolver,并且控制器类也应位于主springapplication下的子目录中。