spring-boot without template engine -
i have spring-boot app apparently way out of norm. it's spring-mvc, don't want use velocity,thymeleaf or anything. ideally use html. use jquery make ajax calls rest services, , fill in pages returned json. way can work put html under /src/resources/templates, , have @controller each page. have:
@springbootapplication
public class application { public static void main(string[] args) throws throwable { springapplication.run( application.class, args ); } } and 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 spring guides , sample projects, don't see how configure this. using starter projects spring-mvc , security, otherwise don't see need navigating :
localhost/home or localhost/about or localhost/customer
or, necessary have @controller each page?
if want use static resources html , javascript can place them subfolder of /src/main/resources named /public, /static or /resources. example file located @ /src/main/resources/public/dummy/index.html accessible via http://localhost/dummy/index.html. won't need controller this.
see reference guide.
Comments
Post a Comment