Problem :
JESSIONID
Today, when the server is stopped and used again, the screen does not appear because the css and js files are not loaded, but after logging in, the screen appears.
Answer :
When I checked the problem with the console, I found that the values in JSESSIONID were not passed when the server was turned on. WebSecurityCustomizer and SecurityFilterChain, it was resolved by declaring both in these two places.
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.mvcMatchers(
"/resources/**", "/static/**", "/landing-assets/**", "/images/**"
, "/custom-scripts/**", "/custom-assets/**", "/assets/**", "/app-assets/**"
, "/templates/**", "/general/**", "/api/v1/pri/**","/api/v1/**","/oauth2/**","/**").permitAll()
@Bean
public WebSecurityCustomizer configure() {
return (web) -> web.ignoring().mvcMatchers(
"/resources/**", "/static/**", "/landing-assets/**", "/images/**"
, "/custom-scripts/**", "/custom-assets/**", "/assets/**", "/app-assets/**"
, "/templates/**", "/general/**", "/api/v1/pri/**","/api/v1/**","/oauth2/**","/**"
);
}
Test Junit
Given , When , Then