io.github.dengchen2020.websocket.config.WebSocketAutoConfiguration Maven / Gradle / Ivy
The newest version!
package io.github.dengchen2020.websocket.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* websocket注解方式自动配置
*
* @author dengchen
* @since 2024/6/12
*/
@Configuration(proxyBeanMethods = false)
public class WebSocketAutoConfiguration {
/**
* 自动注入websocket处理器
*/
@ConditionalOnMissingBean(ServerEndpointExporter.class)
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}