Reputation: 5
Technology : Spring Boot with themeleaf
I'm trying to access the css file placed under src/main/resources/assets/vendor/bootstrap/css/bootstrap.css on my HTML using the following code:
But it is not loading.
Folder Structure :
Resources
--->assets
------>vendor
--------->bootstrap
------------>css
--------------->bootstrap.css
--->code
Can any one help me in this?
Upvotes: 0
Views: 347
Reputation: 1902
Here is my spring security config,
http.
csrf().disable()
.authorizeRequests()
.antMatchers("/home/**", "/**", "/css/**", "/js/**", "/fonts/**", "/images/**", "/public/rest/**","/login*","/signin/**","/signup/**").permitAll()
.antMatchers("/property/**").authenticated()
.antMatchers("/welcome/**").authenticated()
.and()
.formLogin().loginPage("/login").permitAll()
.and().httpBasic().disable();
Simply you need this line,
.antMatchers("/home/**", "/**", "/css/**", "/js/**", "/fonts/**", "/images/**", "/public/rest/**","/login*","/signin/**","/signup/**").permitAll()
But, I would suggest to disable security first and check if everything is working. If that works, then reenable security and try to configure it like shown.
Upvotes: 1
Reputation: 1902
From my working project. The resources is under resources/static/js/script.js. And I am accessing it from html like js/script.js. No issue. Probably you are missing static folder. And if you are using spring security, you need to make the resources available.
Upvotes: 0