3

I have uploaded my project on the project to git https://github.com/gitekiras/spring-boot-gradle-mvc

What i am not able to get right is that i am not able to load the css and js from the resources folder.

When i put it in webapp folder, i am able to get every thing working but according to the tutorials, i should put them in the static folder in resources.

but when i do so i am not able to load the css and js on page.

Can any one say what i am missing ?

Also: when i see in browser logs - it shows that it is trying to find the js and css files as application/json. I am not sure what i have done wrong here.

4
  • If you extract the resulting jar file after your build completes, do you see the static assets? Commented Jul 21, 2015 at 16:41
  • no the build folder contains the folders but not the files. Commented Jul 21, 2015 at 16:46
  • In Maven I typically define a copy resources build configuration to copy all the resources to the artifact. Commented Jul 21, 2015 at 17:12
  • Have a look at my pom.xml in the build config. I'm not familiar with Gradle, but I imagine there's an equivalent. github.com/pgrimard/boot-angular-starter/blob/master/pom.xml Commented Jul 21, 2015 at 17:33

1 Answer 1

1

You explicitly overrode the default behavior by adding your own @EnableWebMvc - see Spring MVC auto-configuration. Remove the @EnableWebMvc (and also unneeded resource handler for /resources/**) and it will work.

Sign up to request clarification or add additional context in comments.

3 Comments

just removed this code and still getting the same error
thanks a ton, i read that line almost 10 times, but didnt notice it.
I have found solution how to make resources load using spring mvc with @EnableWebMvc annotation , tag me if any one needs help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.