2013-08-08 3 views
1

내가 봄 내 스프링 설정 파일을 hiberent에 새로운 오전은 예외에게'컨텍스트 : 구성 요소 검사'

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xmlns:beans="http://www.springframework.org/schema/beans" 
xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
xsi:schemaLocation="http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd 
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd 
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.2.xsd"> 
<mvc:annotation-driven></mvc:annotation-driven> 
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
<property name="prefix" value="/WEB-INF/"/> 
<property name="suffix" value=".jsp"/> 
    </bean> 
    <context:component-scan></context:component-scan> 
    </beans> 
를 던졌습니다

그것은 cvc-complex-type4를 제공합니다 : 'base-package'속성은 'context : component-scan'요소에 나타나야합니다.

답변

2

그냥 오류 정보]를 읽고, 당신은 패키지를 스캔 봄 말해 @Component, @Service, @Controller와 모든 빈 주석을 추가하려면이

<context:component-scan base-package="com.xxx.service"/> 

같은 구성 요소 검사를 추가해야 스프링 컨텍스트에 이르기까지.

이 기본 패키지에서 클래스에 위의 주석을 추가하면이 bean을 봄 컨텍스트로 사용할 수 있습니다.

관련 문제