Skip to content

Can not start spring application with webflux and websocket for ObjectPostProcessor is needed. #5932

@Ayden-Franklin

Description

@Ayden-Franklin

Summary

***************************
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.

Actual Behavior

Fail to start. BUT it works well without dependency of 'org.springframework.boot:spring-boot-starter-websocket'

Configuration

@Configuration
@EnableWebFluxSecurity
public class WebSecurityConfig {
    @Bean
    public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
       ...
    }
   ...
}
@Configuration
public class WebSocketConfiguration {
    @Bean
    public HandlerMapping handlerMapping() {
        Map<String, WebSocketHandler> map = new HashMap<>();
        map.put("/websocket", new WebSocketMessageHandler());
        SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
        mapping.setUrlMap(map);
        mapping.setOrder(-1); // before annotated controllers
        return mapping;
    }

    @Bean
    public WebSocketHandlerAdapter handlerAdapter() {
        return new WebSocketHandlerAdapter();
    }
}

Version

spring boot 2.0.5.RELEASE
io.spring.platform:platform-bom:Cairo-SR4
org.springframework.cloud:spring-cloud-dependencies:Finchley.SR1

Sample

Metadata

Metadata

Assignees

Labels

status: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions