将Spring安全性Java配置与基于xml配置的项目集成

时间:2017-11-05 11:38:13

标签: spring spring-mvc servlets spring-security servletcontextlistener

我是Spring框架中的新手,现在我正在努力将基于Spring的Spring安全配置示例与现有的基于xml的项目配置集成。 我已将以下行包含在web.xml中,以便将安全性配置链接到xml config:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>MobileDrive_Maven</display-name>
  <servlet>
    <servlet-name>spring-dispatcher</servlet-name>
    <servlet-class>
                  org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>spring-dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

    <!-- Loads Spring Security config file -->
    <context-param>
        <param-name>contextClass</param-name>
        <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>    
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>com.websystique.springmvc.security</param-value>
        <!-- <param-value>/WEB-INF/spring-security.xml</param-value> -->
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
</web-app>

我错过了什么,因为我收到一个错误,它无法在内部自动装配内容(注入自动连接的依赖项失败)?

0 个答案:

没有答案