@Controller
@RequestMapping("front")
public class FrontendController {
@GetMapping("/hello")
public String hello(){
System.out.println("porttest");
return "hello";
}
}
going tohttp://localhost:8080/front/hello
gives whitelabel error and
Circular view path [hello]: would dispatch back to the current handler URL [/front/hello] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
如果我将返回值从“ hello”更改为其他任何值,那么我会收到带有其他消息的白色标签
No message available
为什么return语句的值这样做?
错误消息是对该问题的巨大暗示。
我将做以下假设:
hello.html
as the viewTo achieve that, you need a registered
ViewResolver
that uses Thymeleaf. If you includespring-boot-starter-thymeleaf
on the classpath, one will be automatically registered for you.Then, move
hello.html
fromstatic
totemplates
and it should work.