본문 바로가기

Spring

[Spring] 정적 리소스 미출력 오류 해결

반응형

 

프로젝트 진행 중 잘 출력되던 이미지가 엑박으로 출력되는 오류가 발생했다

관련해서 찾아보니, 이미지 폴더에 대해 Spring Security 처리를 해주지 않아 발생한 문제였다.

 

OAuth 로그인 기능을 추가하며 홈 화면 이외의 경로에 대해 보안 처리하도록 설정이 되어있었는데, 이미지 폴더는 보지 않도록 처리해주었다.

 

이미지 폴더 경로는 /src/main/resources/static/images/** 이다.

 

@Override
	protected void configure(HttpSecurity http) throws Exception {
		http.authorizeRequests()
				.antMatchers("/", "/index", "/login/**", "/images/**").permitAll()
				.anyRequest().authenticated();
    }

 

 

 

reference : https://recordsoflife.tistory.com/185

반응형