안녕하세요 여러분, 저는 Spring 3.2.3, hibernate 4.2.2 및 org.springframework.security 3.0.5를 사용하고 있습니다. 봄에 보안 작업을 시작하기 전에 내 컨텍스트 파일은 servlet-context.xml이라고하고 모든 것이 잘 동작했습니다.이름이 appServlet-servlet.xml 인 문제
java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/appServlet-servlet.xml]
내 web.xml 파일은 다음과 같습니다 :
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Spring MVC -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/servlet-context.xml,
/WEB-INF/spring-security.xml
</param-value>
</context-param>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
내가 org.springframework.security 3.0.5를 사용하기 때문에 내 응용 프로그램을 실행하려고하면 나는 오류 servlet-context.xml을 지정하고 있음을 주목하십시오.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/servlet-context.xml,
/WEB-INF/spring-security.xml
</param-value>
</context-param>
web.xml을 그대로두고 applet-servlet.xml이라는 새 파일에 내 servlet-context.xml 내용을 복사/붙여 넣기하면 모든 것이 잘 동작합니다. web.xml에 내 컨텍스트 파일 이름이 servlet-context.xml이라고 말한 이후로 이것은 혼란 스럽습니다. 컨텍스트 파일을 appServlet-servlet.xml로 호출해야만합니까? 물론 servlet-context.xml을 삭제하고 web.xml에 specSiciation을 작성한 appServlet-servlet.xml을 그대로두면 제대로 작동합니다.
내 응용 프로그램에서 스프링 보안을 사용하려는 경우 내 컨텍스트 파일을 appServlet-servlet.xml로 호출해야 하는지를 알고 싶습니다.
을하지만 그것이 작동하는 방식 인 경우, 왜 내가 내 "서블릿-context.xml에"작업을 할 수 있었다 봄 보안을 사용하기 시작하기 전에?. – kiduxa
오, 이제 더 잘 이해합니다. 귀하의 링크는 매우 유용했습니다. 스프링 보안을 사용하기 전에, 내 web.xml에서 "WebApplicationContext"를 사용했습니다. 왜 그렇게 잘 작동했는지. 감사합니다. @Julien :) – kiduxa
해피 도움이 :) – Julien