Embedded ActiveMQ Broker (TCP) using Spring’s @Configuration
I haven’t found it on the Internet or at least it wasn’t easy, so I leave it here: How to create an embedded ActiveMQ Broker which is started with the application context, listens on a given TCP port and is configured in Java Config @Configuration class.
@Configuration public class AppConfig { public static final String BROKER_URL = "tcp://localhost:6060"; @Bean public BrokerService broker() throws Exception { BrokerService brokerService = new BrokerService(); brokerService.addConnector(new URI(BROKER_URL)); brokerService.setPersistent(false); return brokerService; } }