0

I have just started working on a spring boot project and I am using stater web as one of its dependency, I used spring.io to create my project from scratch and from there itself I got

plugins {
    id 'org.springframework.boot' version '2.1.6.RELEASE'
    id 'java'
}

Now the problem I faced is my static content is not loading properly. I can see the static URL on browser's dev-tools with 200 OK message(which probably means a successful response of a get request) but still, the styles are not there as my CSS is not loading. but if I use spring boot version 2.0.4 then everything works fine. I went through release notes for spring boot version '2.1.6 RELEASE' but couldn't find anything except this

Auto-Configuration Exclusion Exclusions are now applied consistently rather than only being applied locally. This applies to any exclusion defined on @EnableAutoConfiguration, @SpringBootApplication, @ImportAutoConfiguration or the spring.autoconfigure.exclude property.

which went over my head.

My question is if someone uses spring.io to create a project from scratch and in return gets all the dependencies compatible version from spring-boot starter parent and still the project for some reason like one mentioned above doesn't work then where should one go to find out what is the problem rather then changing version's.

rimonmostafiz
  • 1,341
  • 1
  • 15
  • 33
Rajan Chauhan
  • 461
  • 2
  • 7
  • 18
  • How you are configuring you static resources? – rimonmostafiz Jul 23 '19 at 17:41
  • Would you add you pom.xml or gradle file ? – jordiburgos Jul 23 '19 at 23:15
  • Hi Jordiburgos i am using gradle as the build tool. – Rajan Chauhan Jul 24 '19 at 03:43
  • @rimonmostafiz i am not doing anything special to configure my static resource, for your reference i am using spring-boot-starter-thymeleaf and spring-boot-starter-web as dependencies. I am not configuring anything just putting my bootstrap files under resources > static folder.From spring.io blog it says that Spring Boot will automatically add static web resources located within any of the following directories: /META-INF/resources/. /resources/. /static/. /public/ – Rajan Chauhan Jul 24 '19 at 07:06
  • default static content location is root of classpath so you should add public, static inside /src/main/resources/public , /src/main/resources/static – psi Jul 31 '19 at 12:59
  • Hi @psi these folder structure are already provided when we create a project from spring initiallizers for instance my current static resources are residing under src/main/resources/static/css i have already discussed above about my static directory structure. – Rajan Chauhan Aug 01 '19 at 14:14

0 Answers0