So I've got a styles.css file under
resources
|-static
|-css
|-styles.css
... all standard stuff.
My WebSecurityConfig looks as follows:
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.headers().frameOptions().sameOrigin().and() // allow the h2-console to be used in a frame
.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/h2-console/**").permitAll() // enable access to the h2-console
.antMatchers("/js/**").permitAll() // permit JS resources
.antMatchers("/css/**").permitAll() // permit CSS resources
...
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}
But whenever I try to open the .css file on my localhost (via http://localhost:8080/css/styles.css) I recieve an unexpected 405 error (Method Not Allowed).
Trying to apply the stylesheet in a html documents prints out the following error in the Google Chrome console:
"refused to apply style from "..." because its MIME type ('application/json') is not a supported stylesheet MIME type, and strict MIME checking is enabled".
I am fairly new to java Spring and have only worked with bootstrap styles up to this point, so I might be missing something really obvious - been searching for an answer for hours -please help me out!
I am running Spring Boot Gradle,
springBootVersion = '2.0.4.RELEASE'