samedi 7 mars 2015

spring-boot basic JSP 404 Not Found

Can't load a very simple JSP page with spring-boot, getting 404 Not Found.


src/main/java/SampleWebJspApplication.java



@Configuration
@EnableAutoConfiguration
@ComponentScan
public class SampleWebJspApplication extends SpringBootServletInitializer {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleWebJspApplication.class, args);
}
}


src/main/java/WebController.java



@Controller
public class WebController {
@RequestMapping("/")
public String welcome() {
return "welcome";
}
}


src/main/webapp/WEB-INF/jsp/welcome.jsp



<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://ift.tt/QfKAz6"%>
<html lang="en">
<body>
<h1>Hello.</h1>
</body>
</html>


Getting 404 even though debugger shows that "welcome" is being returned from the Controller RequestMapping.



Whitelabel Error Page


This application has no explicit mapping for /error, so you are seeing this as a fallback.


Sat Mar 07 19:35:15 EST 2015 There was an unexpected error (type=Not Found, status=404).



Aucun commentaire:

Enregistrer un commentaire