2013-11-22 30 views
1

我已经延长WebSecurityConfigurerAdapter的IllegalStateException异常,但我每次开始时间码头,我得到异常:春WebSecurityConfigurerAdapter不断抛出,因为@Order

java.lang.IllegalStateException:上WebSecurityConfigurers @Order必须是唯一的。已经使用2147433647的顺序,所以它不能用于com.x[email protected]332c45ff。

我以前没有使用@Order标注类,并开始获取异常。目前,我有@Order(Ordered.LOWEST_PRECEDENCE - 50000)注解了我的类。我为这个注释尝试了几个不同的值,但总是得到上面的异常,说@Order必须是唯一的,并且已经使用了计算的值。我正在使用Spring Security 3.1.4.RELEASE和Spring Security JavaConfig 1.0.0.M1。

回答

3

我相信我已经解决了这个问题。我有一个名为AppConfig的中心@Configuration类,它也有一个@Import({SecurityConfig.class})注释。我删除了@Import注释并添加了@ComponentScan,现在它可以工作。

+0

你应该庆祝自己的答案除外:d,使其没有显示在选项卡上未答复http://stackoverflow.com/unanswered –

0

当在集成测试延长WebSecurityConfigurerAdapter,你不妨更换..

@Import({SecurityConfig.class}) 

..by ..

@ContextConfiguration(classes = SecurityConfig.class) 
相关问题