Paymon Wang-Lotfi
Paymon Wang-Lotfi

Reputation: 555

How to put an Html Page in a spring-boot application using Gradle

I followed this guide to create a REST Web Service: https://spring.io/guides/gs/rest-service/

Everything is working fine, I can visit http://localhost:8080/greeting to see the helloworld greeting. But what I want to do is add an html page to the website, that makes an AJAX call to the web service. I was just wondering where I place this html file and what url I would have to visit to see it.

Upvotes: 0

Views: 1148

Answers (1)

Vampire
Vampire

Reputation: 38629

According to https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot you just have to put your file in /META-INF/resources/, /resources/, /static/ or /public/ to get it served automatically. So just putting it into src/main/resources/static/foo.html should probably be enough to be able to access it as http://localhost:8080/foo.html.

Upvotes: 2

Related Questions