In this blog post, I will look at the Solace Java Spring Boot project which provides a Spring Boot Starter for the Solace Java API with support for Spring auto-configuration. This is a follow up blog post to my first post on the topic of Spring Boot Starters which discussed JMS.

To recap, as part of Solace Labs, we’ve shared two projects to help other Solace users easily use Solace Messaging as the foundation for their Spring Boot microservices and applications:

Following the Solace Labs model, both projects are open source and we welcome contributions, suggestions and ideas from the community. We’ll keep updating these projects as we use them more ourselves, but already they are making our applications simpler. In this blog post, I’ll focus on the Solace Java Spring Boot Starter.

Using the Solace Java API with Spring Boot

The Solace Java Spring Boot Starter and Auto-Configuration is very similar to the Solace JMS project in how it functions. It provides an auto-configuration implementation and Spring Boot starter POM for the Solace Java API. However, in this case your application is using the Solace Java API and therefore will contain Solace Java API calls in the application. Spring Boot Applications wishing to use Solace Java need to do the following things:

  • Adding the solace-java-spring-boot-starter dependency to the build.
  • Update your application to use the SpringJCSMPFactory
  • Configure your application properties.

Updating your build

To use Solace Messaging you need to add a single dependency pointing to the Solace Java Spring Boot Starter POM. This POM follows the Spring Boot Starter pattern and manages all other dependencies that your application needs to use the Solace Java API including the underlying Solace Java client library. For example, in Gradle:


or with Maven:


Updating your application to use the SpringJCSMPFactory

To facilitate Spring dependency injection, this project introduces a new Solace Java API factory (SpringJCSMPFactory). This class maintains the same interface as the Singleton JCSMPFactory in the Solace Java API but it contains an associated JCSMPProperties. This makes it easy to auto-wire this dependency in your code:

private SpringJCSMPFactory solaceFactory;

Once you have the SpringJCSMPFactory, it behaves just like the JCSMPFactory and can be used to create JCSMPSessions. For example:

final JCSMPSession session = solaceFactory.createSession();

This is explained in more detail in the project readme. Also the project contains a sample which illustrates simple usage.

Configuring your application

The final step is to provide the Solace Message Router configuration properties to your application. Spring Boot provides multiple ways to externalize your configuration properties of your application. In this example, I’ll use the approach. But you could also use a Spring Configuration Server or whatever method is the norm in your environment.

In your, you need to add any details required by the Solace Java API to connect with the Solace Message Router. At a minimum you must specify the host. For example:

You can add other details like message-vpn, client-username, client-password by adding additional properties to See the project readme for a full list of what is supported.


To see this all in action, checkout the sample which illustrates the points explained in the blog. And again, I think it’s easy to see why the Solace Spring Boot Starters combined with auto-configuration simplify Solace Messaging applications. Why don’t you try them out yourself in your application and see how it can help you?

If you’re new to the Solace Java API and would like more help getting up and running there are nice tutorials here:

Mark Spielman

Mark Spielman is a product leader with 15+ years of experience helping customers become event driven while building the products they need to become more successful. His current passion with Solace is making sure PubSub+ Cloud is the right choice for everyone looking to modernize their business and embrace event-driven transformation.

Throughout his career, he has had experience and interest in a wide range of topics including large-scale enterprise architecture, cloud platforms, developer engagement, SaaS, agile teams, cross-functional team building, operations and process improvements, product go-to-market, pricing strategies and data-driven product design.

Mark holds a B.A.Sc. in Computer Engineering from the University of Waterloo and always enjoys learning new things.