I have a Spring-Boot app that is apparently way out of the norm. It's Spring-MVC, but I don't want to use velocity,thymeleaf or anything. Ideally I would just use HTML. Then I use jQuery to make my AJAX calls to my REST services, and then fill in the pages with the returned JSON. The only way I can mostly get this to work is to put my html under /src/resources/templates
, and then have a @Controller for each page. So I have:
@SpringBootApplication
public class Application {
public static void main(String[] args) throws Throwable {
SpringApplication.run( Application.class, args );
}
}
and my controllers
@Controller
public class HomeController {
@RequestMapping("/")
public String getHome() {
return "index"
}
and
@Controller
public class AboutController {
@RequestMapping("/about")
public String getAbout() {
return "about"
}
I have looked thru the Spring guides and sample projects, but I don't see how to configure this. I am using the starter projects to get spring-mvc and security, but otherwise I don't see what I need to do this so navigating to :
localhost/home or localhost/about or localhost/customer
Or, is it necessary to have a @Controller for each page?