Thymeleaf + CSS+SpringBoot

前端 未结 3 1348
别跟我提以往
别跟我提以往 2020-12-03 07:06

I have a problem with CSS and Thymeleaf.

In my Spring boot app, I have this structure:

  • src/main/resource/static/css (for css files)
  • src/main/r
3条回答
  •  盖世英雄少女心
    2020-12-03 07:34

    The main culprit of this behaviour is a custom security configuration which is very likely you are doing in your WebSecurityConfigurerAdapter subclass. If you use SpringBoot 2+ version you should add the following line in your WebSecurityConfigurerAdapter configuration

    .requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()

提交回复
热议问题