«   2026/01   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

wedul

Spring에서 task executor를 사용하여 비동기 설정시 xml 오류 해결 본문

web/Spring

Spring에서 task executor를 사용하여 비동기 설정시 xml 오류 해결

wedul 2018. 6. 19. 21:39
반응형

Spring에서 Async 개발을 진행하기 위해서 task executor를 사용해야했다.


그래서 servlet-context.xml에 task-executor 관련 내용을 쓰겠다고 설정하려고 하였다. 설정내용은 다음과 같았다.


1
2
3
4
5
6
7
8
9
10
11
12
xmlns:task=http://www.springframework.org/schema/task
 
 
// xsi:schemaLocation 
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.1.xsd
 
// pool 사이즈 설정
<task:executor id="myexecutor" pool-size="5"  />
<task:annotation-driven executor="myexecutor"/>
 
 
cs


다음과 같이 설정을 진행하였는데, cvc-complex-type.2.4.c: The matching wildcard is strict... 와 xml document from servletcontext resources context initialization failed, no declaration can be found for element 'task:executor' 와 같은 오류가 발생하였다.


이는 삽질을 하였는데 문제는 위에 코드 내용에서 6번째 라인에 있었다.

6번째 라인에 spring-task-4.1.xsd 부분이 문제였는데 spring 버전이 3.2 인데 task 버전이 4.1로 기재해서 문제가 발생했다.


다음과 같이 변경해주니 문제가 해결되었다.  


1
http://www.springframework.org/schema/task/spring-task-4.1.xsd
cs


반응형