我刚刚使用lognet.grpc spring Boot starter实现了GRPC,在启动应用程序时出现了以下错误。
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' in your configuration.
下面是SpringSecuritySecurityClass
@Configuration
@EnableWebSecurity
@ImportResource({"classpath:spring-ADFS-security.xml"})
public class SpringSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
private OAuthUserDetailsService userDetailsService;
@Primary
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Primary
@Bean
public PasswordEncoder encoder() {
return new StandardPasswordEncoder();
}
@Autowired
protected void globalUserDetails(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(encoder());
}
/**
* @Order annotation is used to advise execution precedence. The highest precedence runs first.
*/
@Override
@Order(Ordered.HIGHEST_PRECEDENCE)
protected void configure(HttpSecurity http) throws Exception {
http.anonymous() //
.disable() //
.authorizeRequests() //
.anyRequest() //
.authenticated() //
.and() //
.httpBasic() //
.and() //
.sessionManagement() //
.sessionCreationPolicy(SessionCreationPolicy.STATELESS) //
.and() //
.csrf() //
.disable();
}
}
这是使用adfs-security的主要配置文件。希望有帮助。
1条答案
按热度按时间vd8tlhqk1#
解决方案:
只需在
application.properties
中添加grpc.security.auth.enabled = false
。根据文件: