My Spring Boot project is not loading view from src/main/resources/templates/login.html. However it does load view from src/main/resources/static/index.html.
Here is my project structure:
I have added simple <a> tag for opening my login page in my index.html
<div>
<a class="btn" href="login">Login</a>
</div>
LoginController:
@RequestMapping("/login")
public String showLogin() {
System.out.println("Login method called");
return "login";
}
This method doesn't get called. Moreover, I have seen many tutorials showing you don't need to add your view in static folder, just add your views in templates folder and Spring Boot will automatically pick it.
But it seems that Spring Boot is not picking views from templates folder and shows white label error page.
I am not using jsp pages instead I am on Thymelead template.
application.properties
server.servlet.context-path=/hisservices
server.port=8081
welcome.message: Welcome to the HIS Services Dashboard
WelcomeController: <- This shows index.html page
// inject via application.properties
@Value("${welcome.message:test}")
private String message = "Hello World";
@RequestMapping("/")
public String welcome(Map<String, Object> model) {
model.put("message", this.message);
return "welcome";
}
Do I need to add explicit mapping for templates folder?

HisservicesJwtApplication.javato outer/upper layer package i.e.com.skm.hisservice.secueejwt- user3145373 ツHisservicesJwtApplication.java- user3145373 ツ