"org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalStateException: @Order on WebSecurityConfigurers must be unique. Order of 100 was already used on com.chinamobile.deepwatch.lancelot.core.config.SecurityConfig$$EnhancerBySpringCGLIB$$85d8e204@6046fba0, so it cannot be used on com.chinamobile.deepwatch.spring.boot.autoconfigure.security.SecurityAutoConfiguration$$EnhancerBySpringCGLIB$$849c6fd2@248ba4fc too." 这个问题是由于在Spring Security的配置类上使用了相同的@Order注解值引起的。@Order注解用于指定Spring Security配置类的加载顺序,每个配置类应该具有唯一的@Order值。 \n\n 要解决这个问题,您需要确保在所有Spring Security配置类中使用不同的@Order值。您可以尝试更改其中一个配置类的@Order值,以确保它与其他配置类不同。例如,您可以将其中一个配置类的@Order值更改为101。 \n\n 另外,如果您使用了@EnableWebSecurity注解来启用Spring Security配置,您还可以尝试将它替换为@EnableAutoConfiguration注解。这将允许Spring Boot自动配置Spring Security,并确保正确的加载顺序。 \n\n 最后,如果您使用了多个Spring Security配置类,还可以考虑使用@Import注解将它们导入到一个主配置类中。这样可以确保它们的加载顺序,并避免冲突。 \n\n 总之,确保每个Spring Security配置类具有唯一的@Order值,并检查是否存在其他可能导致冲突的配置。

Spring Security BeanCreationException: @Order Conflict 解决方法