security-context.xml 설정 시 네임스페이스에서 문제가 발생하는 경우 해결법
1. 에러 메세지 (Error Message)
Multiple annotations found at this line:
- You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or spring-security-3.1.xsd schema or spring-security-3.2.xsd schema or spring-security-4.0.xsd schema with Spring
Security 4.2. Please update your schema declarations to the 4.2 schema.
- Configuration problem: You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or spring-security-3.1.xsd schema or spring-security-3.2.xsd schema or spring-security-4.0.xsd
schema with Spring Security 4.2. Please update your schema declarations to the 4.2 schema. Offending resource: file [C:/Users/berry/eclipse-workspace/sendAGift_202005/SendAGift_202005/src/
main/webapp/WEB-INF/spring/security-context.xml]
2. 해결 전
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-5.0.xsd">
xsi:schemaLocation의 주소를 변경해줍니다.
http://www.springframework.org/schema/security/spring-security-5.0.xsd
아래와 같이 5.0 버전 표기를 삭제합니다.
http://www.springframework.org/schema/security/spring-security.xsd
3. 해결 후
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
참고 사이트 : https://stackoverrun.com/ko/q/10928899