Spring Boot (3) Selecting the service dynamically
1. Defining the services implementing an interface The aim is to get a service dynamically by its class name. First, a simple interface is defined (IProcess.java) package websocket . services ; import java . util . Map ; import org . springframework . messaging . simp . SimpMessageSendingOperations ; public interface IProcess { public boolean execute ( SimpMessageSendingOperations messagingTemplate , String subscription , Map < String , Object > map ) ; } Let's create some services implementing this interface (but only one is shown) for instance Process01 package websocket . services ; import java . util . Map ; import org . springframework . messaging . simp . SimpMessageSendingOperations ; import org . springframework . stereotype . Service ; @Service("Proces01") public class Process01 implements IProcess { @Override public boolean execute ( SimpMessageSendingOperations messagingTemplate , String subscription ...