【发布时间】:2021-12-06 14:36:43
【问题描述】:
我在使用StandardWebSocketClient 的Java 客户端上使用spring stomp websocket,很像这个例子:
https://www.baeldung.com/websockets-api-java-spring-client
使用spring-boot-starter-websocketmaven dep添加了太多客户端不需要的dep,于是想出了:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.embed.websocket.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>tomcat-annotations-api</artifactId>
<groupId>org.apache.tomcat</groupId>
</exclusion>
</exclusions>
</dependency>
tomcat-embed-websocket 是提供javax.websocket 实现。但它相当大,因为它添加了tomcat-embed-core。
我尝试使用Tyrus,但不知道要添加哪些部门。
Tyrus 会更小吗?如何只添加客户端?
【问题讨论】: