Java 重写Spring身份验证提供程序

Java 重写Spring身份验证提供程序,java,maven,spring-security,selenium-webdriver,tomcat7,Java,Maven,Spring Security,Selenium Webdriver,Tomcat7,我正在使用maven运行tomcat的一个实例来进行一些集成测试。我正在使用tomcat7 maven插件工件。当tomcat启动时,它会将一堆Spring配置文件bean加载到上下文中,这是my web.xml的结果: mspWebManager-security-test-context.xml的内部是以下xml: <authentication-manager> <authentication-provider user-service-ref="userDeta

我正在使用maven运行tomcat的一个实例来进行一些集成测试。我正在使用tomcat7 maven插件工件。当tomcat启动时,它会将一堆Spring配置文件bean加载到上下文中,这是my web.xml的结果:

mspWebManager-security-test-context.xml的内部是以下xml:

<authentication-manager>
    <authentication-provider user-service-ref="userDetailsServiceMock"/>
</authentication-manager>
但是,当我在测试用例中发出请求时,我正在使用Selenium btw发出请求,前面定义的PreAuthProvider总是被使用。有没有办法克服这个问题

我对Spring和tomcat比较陌生,所以我愿意接受关于最好的方法的建议。我尝试过的另一件事是设置一个maven测试概要文件,尝试让tomcat使用不同的web.xml文件,但这不起作用

谢谢

<sec:authentication-manager alias="authenticationManager">        
    <sec:authentication-provider ref="preauthAuthProvider" />         
</sec:authentication-manager>
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations={"classpath:/mpsWebManager-test-context.xml",
            "classpath:/mspWebManager-security-test-context.xml"})
public class SeleniumIT {....test cases....}
<authentication-manager>
    <authentication-provider user-service-ref="userDetailsServiceMock"/>
</authentication-manager>