masa
masa

Reputation: 2800

How to override AutoConfiguration in Spring?

I have followed the Spring example Serving Mobile Web Content with Spring MVC and got it working.

Now I would like to replace greeting.html with a simple static page (and replace Thymeleaf with a simpler view handler).

What is the easiest approach in this particular case?

I am new to Java, the probable solutions in web use web.xml, whereas this example does not use web.xml and it does not seem to be the recommended approach in Spring Boot documentation either. So, use @EnableAutoConfiguration with some overriding? How?

Upvotes: 0

Views: 1232

Answers (1)

geoand
geoand

Reputation: 64011

All you have to do is put the static HTML file in a place where Spring Boot will automatically look for static resources. This part of the documentation provides all the details.

So for example you can place your greeting.html under /src/main/resources/static/ and you will be able to access it at http://localhost:8080/greeting.html (that's if you have not configured a different port of the root path of the servlet context)

Upvotes: 1

Related Questions