If you’re not familiar with start.spring.io, it hosts the Spring Engineering team’s opinionated version of Spring Initializr, which allows developers to generate Spring Boot projects pre-populated with the dependencies they need to get started quickly.
Spring Developer Advocate Josh Long calls start.spring.io the “second-best place on the internet,” and it just got better! Why do I say that? Because Solace PubSub+ is now available on start.spring.io, enabling developers to create event-driven microservices.
Did you know?
At SpringOne Platform 2019, Spring announced that developers use start.spring.io to generate 15 million projects each year! And that number is growing by 64% per year.
As a developer who has been creating event-driven applications with a combination of the Spring Framework and Solace PubSub+ for about eight years, I love how the developer experience keeps improving. This is the next step.
When selected as a dependency on Initializr at start.spring.io, the `Solace PubSub+’ option informs Initializr to add the Solace JMS Spring Boot Starter to the maven pom or build.gradle file as a dependency. This enables autoconfiguration of a ConnectionFactory or JndiTemplate, allowing developers to use Spring Boot to easily create event-driven microservices with PubSub+ and the JMS API. Using PubSub+ to create event-driven microservices empowers developers to use the best message exchange patterns for their use case, such as publish/subscribe, queuing, request/reply and it even provides the ability to store & replay. The use of PubSub+ also allows developers to take advantage of all the benefits of having events flow over the Event Mesh, such as being able to communicate with applications using other APIs and protocols and built-in high availability and disaster recovery.
Maven Example:
<dependency> <groupId>com.solace.spring.boot</groupId> <artifactId>solace-jms-spring-boot-starter</artifactId> <version>3.2.0</version> </dependency>
Want to give it a shot? Spring Initializr offers several ways to generate your Spring Boot project. You can do it using the Web UI, from your favorite IDE or even from the command-line.
- Web: Use this link to start.spring.io to use the Initializr Web UI, and yes it even offers a dark mode! You can choose your project type (Maven or Gradle), programming language, project dependencies and more. You’ll find the Solace PubSub+ dependency by looking under the “Messaging” section, searching for “solace” or if you use the link above, we’ve pre-populated the Solace PubSub+ dependency for you ;). Once you’ve made your choices, click the Generate button to download a zip file of your Spring Boot project.
- IDE: You can also create Spring Boot projects from your favorite IDE. These IDEs currently support Initializr: Spring Tool Suite, IntelliJ IDEA Ultimate, NetBeans (with this plugin) or VSCode (with the vscode-spring-initializr plugin). Which Initializr do you think they use by default? If you guessed the one at start.spring.io, you’re correct.
For example, when using the Spring Tool Suite IDE for development, you can create a new Spring Starter Project and under the covers Initializr will generate your project. Check out the options available in the image below.
After choosing those initial options and selecting Next, you will be asked to choose dependencies. You’ll find Solace PubSub+ under the Messaging dropdown. Choose it, click Finish, and a Spring Boot project is generated right in your IDE.
- CLI: Not a fan of a GUI? No worries, you can generate Spring Boot projects from the command line as well. For example, if you want to generate a zip file containing a project with Java 11 and Solace PubSub+ as a dependency, you could execute:
curl https://start.spring.io/starter.zip -d dependencies=solace -d javaVersion=11 -o demo.zip
Or to see all available options, execute `curl -XGET https://start.spring.io` as seen in the image below.
Now that you’ve used Spring Initializr to generate your Spring Boot project with Solace’s Spring Boot JMS Starter as a dependency, it’s time to code your event-driven microservice. You can learn more about using our Spring Boot JMS Starter using the following resources:
- Blog: Solace JMS Meet Spring Boot Starters
- Tutorial: Spring Boot Autoconfig (JMS)
If you have any questions, feel free to ask them in the Solace Developer Community with the `Spring` tag.
And if you love start.spring.io so much that you want to learn more about how it works, watch Stéphane Nicoll’s talk from SpringOne Platform 2019: Creating “The Second Best Place on the Internet” with Spring Initializr
The Spring + Solace developer experience has come a long way in the last eight years and I’m excited to see it continuously improve. Check out solace.com/spring to see all the ways you can use Spring with Solace and stay tuned for more upcoming Spring + Solace news. Hint: Solace Spring & Solace AsyncAPI.
Until next time, Happy Eventing!