When to use @ServerEndpoint vs @Controller in Java spring boot framework?

locke14 :

Can someone point out the differences between the 2 and when it is appropriate to use which one?

Voodoo :

When a class annotated by @ServerEndpoint is registered to a server-side WebSocket endpoint and every time the corresponding endpoint's WebSocket is connected to the server, its instance is created and managed by JWA implementation.

Classic controllers can be annotated with the @Controller annotation. This is simply a specialization of the @Component class and allows implementation classes to be autodetected through the classpath scanning.

Hope this helps

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=125772&siteId=1