• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

핸들러 singleton Exception이 발생합니다

20.07.22 14:29 작성 조회수 5.35k

0

ajaxAuthenticationSuccessHandler
ajaxAuthenticationFailureHandler

이번 강의에 새로 배운 핸들러를 등록하고 구동하려 하니

이전 SecurityContext에서 @Autowired했던 
formAuthenticationSuccessHandler()와 충돌이 납니다.

아래는 에러 내용입니다. 

물론, @Qualifier를 해주니 에러는 안생기지만 강사님이

강의하신 내용이나 git전체소스를 봐도 @Qualifer를 해주는 부분은 없습니다. 어떻게 해야할까요?

========에러 내용=================

Exception in thread "task-2" org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'delegatingApplicationListener': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

답변 6

·

답변을 작성해보세요.

0

이한솔님의 프로필

이한솔

질문자

2020.07.28

감사합니다. 해결되었습니다!

0

@Qualifier("customAuthenticationSuccesshandler")
@Autowired
private AuthenticationSuccessHandler formAuthenticationSuccessHandler;

@Qualifier("customAuthenticationFailurehandler")
@Autowired
private AuthenticationFailureHandler formAuthenticationFailureHandler;

을 아래와 같이 변경해 보시기 바랍니다.

AuthenticationSuccessHandler 인터페이스 타입을 사용하는 경우에는 타입 충돌이 발생하지 않도록

클래스이름의 변수명을 적어 주셔야 합니다.

@Autowired
private AuthenticationSuccessHandler customAuthenticationSuccesshandler;

@Autowired
private AuthenticationFailureHandler customAuthenticationFailurehandler;

0

이한솔님의 프로필

이한솔

질문자

2020.07.23

SecurityApplication 만 있는것은 master 브랜치고 `ajax_인증인가처리` 브랜치 보시면 코드 확인 가능하실것입니다 ㅠ

0

위 github 에는 관련 소스 파일이 존재 하지 않는 것 같습니다.

SecurityApplication 파일만 보입니다.

확인 부탁드립니다.

0

이한솔님의 프로필

이한솔

질문자

2020.07.22

https://github.com/catsbi/spring-security-lecture.git

깃소스입니다. 여기서 브랜치중 ajax_인증인가처리 부분입니다. ㅠㅠ 

0

음..

해당 오류 내용만 봐서는 어디 지점에서 발생하는 것인지 정확한 원인을 알기 힘드네요

가능하시다면 오류와 관련된 파일 전체 소스들을 볼 수 있을까요?