我在Spring Tool Suite中的项目报告无法为项目XXX加载注释处理器工厂'org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor',我的项目运行正常,但我不想看到这个错误。我做了很多搜索,但我找不到任何结果。 非常感谢。
答案 0 :(得分:4)
从项目根目录中删除@Configuration
public class SecurityConfig2 {
@Configuration
public static class RegularSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/css/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/regular/login")
.defaultSuccessUrl("/regular/home")
.permitAll()
.and()
.logout()
.logoutUrl("/regular/logout")
.permitAll();
}
}
@Configuration
@Order(1)
public static class GenericMandantSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.antMatcher("/man-{mandant}/**")
.authorizeRequests()
.anyRequest().access("hasRole('USER_#mandant')")
.and()
.formLogin()
.loginPage("/man-{mandant}/login")
.defaultSuccessUrl("/man-{mandant}/home")
.permitAll()
.and()
.logout()
.logoutUrl("/man-{mandant}/logout")
.permitAll();
}
}
...
}
文件。
答案 1 :(得分:1)
您需要将spring boot配置处理器添加到项目中;使用maven时添加此依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
您可以在spring boot documentation中找到更多信息。