내가 추가하는 모든 서블릿에 대한 새로운 설정 파일을 필요로하지 않도록 스프링 MVC 구성을 개선하려고하지만 문제가있다. 나는 this tutorial을 시작점으로 사용해 보았지만, 나는 알아 내지 못하는 문제에 직면하고있다.스프링 MVC 주석 설정 문제
문제점은 내 서블릿에 GET 할 때 404 오류가 발생한다는 것입니다. 여기 내 설정입니다 및 대표 자바는 컨트롤러에서 니펫을 :
의 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">
<display-name>SightLogix Coordination System</display-name>
<description>SightLogix Coordination System</description>
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/application-context.xml
/WEB-INF/application-security.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/slcs/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/application-context.xml
/WEB-INF/application-security.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<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>
</web-app>
응용 프로그램의 context.xml :
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-init-method="init" default-destroy-method="destroy">
<mvc:annotation-driven />
<context:component-scan base-package="top.level" />
</beans>
응용 프로그램-security.xml :
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<http>
<intercept-url pattern="/**" access="ROLE_MANAGER" requires-channel="https" />
<http-basic />
</http>
<authentication-manager>
<authentication-provider user-service-ref="myUserDetailsService">
<password-encoder hash="sha"/>
</authentication-provider>
</authentication-manager>
<beans:bean id="myUserDetailsService"
class="path.to.my.UserDetailsServiceImpl">
</beans:bean>
</beans:beans>
컨트롤러 클래스의 스 니펫 (많은 것 중 하나이지만이 모든 것이 본질적으로 비슷합니다) :
@Controller
@RequestMapping("/foo.xml")
public class FooController
{
@RequestMapping(method=RequestMethod.GET)
public void handleGET(HttpServletRequest request, HttpServletResponse response) throws IOException
{
...
누구나 내가 잘못하고있는 것을 말할 수 있습니까? 감사합니다.
/slcs/foo.xml을 HTTPS의 URL로 사용하고 있습니까? –
@TaylorL : 예, 있습니다. – Seth