试图为现有项目添加spring security,现在get无法初始化上下文错误

时间:2015-10-11 06:27:19

标签: java spring spring-mvc spring-security

尝试为Spring Pet Clinic应用程序添加安全性。我通过向此项目添加两个类SecurityConfigCannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml! 来实现此目的,现在我收到此错误:

web.xml

确实在ContextLoaderListener中提到了MessageSecurityWebApplicationInitizializer

AbstractSecurityWebApplicationInitializer只是扩展ContextLoaderListener而没有自定义。我相信这个类加载了额外的{{1}},但不知道如何防止这种情况,或者如果这样做是可取的。我尝试实现界面并执行此问题中的建议: Why this Spring application with java-based configuration don't work properly

但这不起作用。

我想知道我是否尝试将Spring XML配置与非XML配置混合使用。但主要是我想让安全工作。

0 个答案:

没有答案