peng
2025-06-13 30b41cc526165b70e04a1fe1438cb79bb035a7bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cn.lili;
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 
 
/**
 * @author liushuai
 */
@SpringBootApplication
public class ImApiApplication {
 
    public static void main(String[] args) {
        SpringApplication.run(ImApiApplication.class, args);
    }
 
    /**
     * 如果使用独立的servlet容器,
     * 而不是直接使用springboot的内置容器,
     * 就不要注入ServerEndpointExporter,
     * 因为它将由容器自己提供和管理
     *
     * @return
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }
}