Thiago Sayão
Thiago Sayão

Reputation: 2357

Smaller deps for spring stomp websocket client

I am using spring stomp websocket on a Java client using StandardWebSocketClient, much like this example:

https://www.baeldung.com/websockets-api-java-spring-client

Using spring-boot-starter-websocket maven dep adds too many deps that are not needed on the client, so I came up with:

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

The tomcat-embed-websocket is to provide a javax.websocket implementation. But it's quite big as it adds tomcat-embed-core.

I tried to use Tyrus but don't know which deps to add.

Would Tyrus be smaller? How to add only client deps?

Upvotes: 0

Views: 537

Answers (1)

Pavel Bucek
Pavel Bucek

Reputation: 5324

Tyrus standalone client bundle might be the best thing to start with

https://repo1.maven.org/maven2/org/glassfish/tyrus/bundles/tyrus-standalone-client/2.0.1/

I'm not sure how big is the tomcat embed core, but this isn't a small lib, it has ~2.2 MB.

Upvotes: 0

Related Questions