헤르메스 LIFE

[Spring] cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'beans'. 본문

Exception

[Spring] cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'beans'.

헤르메스의날개 2021. 6. 18. 00:39
728x90

개발환경 : Spring 5.x

여러가지 이유가 많은 모양입니다.

아래와 같이 설정했더니, 오류가 발생했습니다.

<beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
			 		    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
			 			http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
                        ">
    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />             
</beans:beans>

오류부분은

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />             

해결방법

Namespace 오류 입니다.

beans 의 설정은 아래와 같이 해야 합니다.

    <!-- Controller의 메서드에서 반환하는 문자열 앞 뒤에 붙힐 경로 정보를 셋팅한다. -->
    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/view/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>
    
    <!-- 정적파일(이미지, 사운드, 동영상, JS, CSS 등등) 경로 셋팅 -->
    <resources mapping="/**" location="/resources/" />

    <beans:bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
    <beans:bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

    <aop:aspectj-autoproxy />
    <beans:bean id="loggerAspect" class="kr.co.softcampus.aop.LoggerAspect" />

 

728x90