해결된 질문
작성
·
458
0
스프링 빈 설정 메타 정보-BeanDefinition 강의 실습 중에 마지막에 xml 파일로 beanDefinition을 만들게 하니까 이런 오류가 뜨더군요
그리고 이전에 만들었던xmlAppContext에서도 같은 오류가 발생했는데요
pdf파일의 예시 코드를 복붙해서 돌렸는데도 같은 오류가 나서질문 드립니다
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [hello.core.member.MemberServiceImpl] for bean with name 'memberService' defined in class path resource [appConfig.xml]; nested exception is java.lang.ClassNotFoundException: hello.core.member.MemberServiceImpl
appConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="memberService" class="hello.core.member.MemberServiceImpl">
<constructor-arg name="memberRepository" ref="memberRepository"/>
</bean>
<bean id="memberRepository" class="hello.core.member.MemoryMemberRepository"/>
<bean id="orderService" class="hello.core.order.OrderServiceImpl">
<constructor-arg name="memberRepository" ref="memberRepository"/>
<constructor-arg name="discountPolicy" ref="discountPolicy"/>
</bean>
<bean id="discountPolicy" class="hello.core.discount.RateDiscountPolicy"/>
</beans>
package member;
public class MemberServiceImpl implements MemberService{
private final MemberRepository memberRepository;
public MemberServiceImpl(MemberRepository memberRepository) {
this.memberRepository = memberRepository;
}
@Override
public void join(Member member) {
memberRepository.save(member);
}
@Override
public Member findMember(Long memberId) {
return memberRepository.findById(memberId);
}
}
헉... 위치가 바뀐 줄 몰랐어요 감사합니다 해결되었습니다