WHYGRAM / WHYGRAM_logs

0 stars 0 forks source link

(세큐리티) `UnsatisfiedDependencyException` 세큐리티 적용 후 `user/join` 화면 안열림 #30

Open HyeonJin-Jang opened 3 years ago

HyeonJin-Jang commented 3 years ago

스크린샷(52)

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'service'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService': Unsatisfied dependency expressed through field 'passwordEncoder'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfig': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'inMemoryUserDetailsManager' defined in class path resource [org/springframework/boot/autoconfigure/security/servlet/UserDetailsServiceAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.provisioning.InMemoryUserDetailsManager]: Factory method 'inMemoryUserDetailsManager' threw exception; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'passwordEncoder': Requested bean is currently in creation: Is there an unresolvable circular reference?

HyeonJin-Jang commented 3 years ago

그냥 톰캣 실행만 해도 에러가 뜬다

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalArgumentException: defaultTarget must start with '/' or with 'http(s)'

HyeonJin-Jang commented 3 years ago

해결 SecurityConfig42번 라인에

  1. feed/home 경로가 없었다
  2. /feed/home 이라고 적어야 하는데 feed/home이라고 적어서, 즉 /를 빼먹었다
  3. 경로(컨트롤러)와 html을 만들고 /feed/home이라고 적어주니 해결되었다

스크린샷(53)