• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

xml 설정파일에서 에러나는 이유 문의

22.03.03 14:34 작성 조회수 241

1

안녕하세요. 선생님. 강의 보고 스프링 프로젝트 잘 따라하고 있다가 에러가 나서 문의드립니다.

구글링을 하고 해결책을 찾아봐도 해결되지 않더라고요 

서버 연결한 뒤 index 화면까지는 나오는데 이후 test 화면이나 result 화면으로 이동하려면 아래와 같은 에러가 뜹니다.

빈 주입이 안됐다는 것 같은데 root-context.xml 에서 

<bean class="kr.co.softcampus.beans.DataBean1" scope="session"/>

<bean class="kr.co.softcampus.beans.DataBean2" id="sessionBean2" scope="session"/>

 

이렇게 넣어주었는데 왜 안되는건지 모르겠습니다.

 

 

EVERE: Servlet.service() for servlet [dispatcher] in context with path [/RequestScopeBeanXml] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'kr.co.softcampus.beans.DataBean1' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.context.annotation.Lazy(true)}] with root cause

org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'kr.co.softcampus.beans.DataBean1' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.context.annotation.Lazy(true)}

답변 2

·

답변을 작성해보세요.

0

sup님의 프로필

sup

2022.08.13

질문자님 해당 문제 해결하셨나요? 저도 같은 에러가 뜹니다. 답변자님 말대로 root-context.xml이랑 web.xml파일을 따로 주신 소스코드랑 비교하면서 봐도 계속 같은 에러가 뜨네요.

0

오류 내용은 bean 정의가 잘못되어  있다는 내용입니다. bean을 정의하는 부분을 다시한번 살펴보시기 바랍니다.

sup님의 프로필

sup

2022.08.13

선생님, bean을 정의하는 부분을 다시한번 살펴보라는게 root-context.xml이랑 web.xml을 다시 살펴보라는 뜻 이신가요? java로는 실습 잘 진행하고 있는데 xml에서 계속 막혀서 제자리 걸음 중입니다. 도와주세요.