Java Autowire在customlogouthandler和custom userdetails中提供空值
我的autowire从控制器和控制器下面的所有子类都可以正常工作。但当我尝试从Spring安全模块自动连接任何bean(使用注释)时,比如通过UserDetails或customlogout处理程序 我已经阅读并找到了两种解决方法 1.去除 2.将一些代码移到父context.xml。但看起来这对我没什么帮助 My web.xmlJava Autowire在customlogouthandler和custom userdetails中提供空值,java,spring,spring-mvc,spring-security,autowired,Java,Spring,Spring Mvc,Spring Security,Autowired,我的autowire从控制器和控制器下面的所有子类都可以正常工作。但当我尝试从Spring安全模块自动连接任何bean(使用注释)时,比如通过UserDetails或customlogout处理程序 我已经阅读并找到了两种解决方法 1.去除 2.将一些代码移到父context.xml。但看起来这对我没什么帮助 My web.xml appServlet org.springframework.web.servlet.DispatcherServlet 上下文配置位置 /WEB-INF/spr
appServlet
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/spring/appServlet/servlet-context.xml
1.
appServlet
/
上下文配置位置
/WEB-INF/spring/database-context.xml,
/WEB-INF/spring/application-security.xml
我的servlet上下文文件具有以下内容:
<mvc:resources mapping="/resources/**" location="/" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources
in the /WEB-INF/views directory -->
<beans:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.inventory" />
<beans:bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<beans:property name="basename" value="classpath:messages"></beans:property>
<beans:property name="defaultEncoding" value="UTF-8"></beans:property>
</beans:bean>
请帮忙 表示未激活自动连线批注。 包括
在database-context.xml、application-security.xml文件中。为什么不包括实际配置之类的相关部分?这是一个很棒的解决方案。。我在应用程序安全上下文中添加了以下内容,它起了作用。。不幸的是。。预授权和安全保护仍无法正常工作,即使我有。。我知道这需要一个单独的问题
<mvc:resources mapping="/resources/**" location="/" />
<!-- Resolves views selected for rendering by @Controllers to .jsp resources
in the /WEB-INF/views directory -->
<beans:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<context:component-scan base-package="com.inventory" />
<beans:bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<beans:property name="basename" value="classpath:messages"></beans:property>
<beans:property name="defaultEncoding" value="UTF-8"></beans:property>
</beans:bean>
<context:annotation-config>