I am trying to add static web content in a spring-boot server using the info here
I have tried adding the .js and .css files I need in the several Folders that the previous link says but it doesn't work:
/META-INF/resources/ /resources/
Note: I didn't created the /static/
and /public/
folders because I don't know the absolute Path in my project.
I have added too the addResourceHandlers
method:
@Override public void addResourceHandlers(ResourceHandlerRegistry registry) { if (!registry.hasMappingForPattern("/webjars/**")) { registry.addResourceHandler("/webjars/**").addResourceLocations( "classpath:/META-INF/resources/webjars/"); } if (!registry.hasMappingForPattern("/**")) { registry.addResourceHandler("/**").addResourceLocations( RESOURCE_LOCATIONS); } }
And the reference in the HTML file are like this:
<script src="bootstrap-switch.js"></script>
Any idea how I can fix that?
UPDATED:
UPDATED 2: trying the @jfcorugedo
Doesnt work. Take a look, is that what was you saying?
UPDATED 3:trying the @jfcorugedo, second advice: