I’ve created a sample Spring Boot
app that demonstrates useful scenario of asynchronous publish / subscribe model. It could be
useful in many ways. Idea is that, for example, you have some API
handling some web requests, and apart from functionality it provides, it also
publishes some event, so that some other thread can react upon it, with main functionality still being processed with request handling thread.
Or even shorter – request handling thread will do it’s job, and publishes some event (using Java
annotation), and some other background thread
will subscribe to event and process it. You can use it for scenario you register user with your API
, and publish user registered event, and in
background you can subscribe to it by sending out e-mail to end user.
8 posts tagged with "spring-boot"
View All TagsFootball application using Spring boot, Thymeleaf and Spring RestTemplate
As part of my effort to adopt Spring Boot
I noticed that I need to learn new view technology in Java
ecosystem, since Spring Boot
doesn't promote JSP
, which I was
used to using. I've explored alternatives a bit, and decided to give a shot to Thymeleaf
as templating engine.
Interesting way to assert thrown exceptions using Spring Boot and Assertj
Traditional exception handling in JUnit tests
You’re probably used to testing code that throws exceptions in either one of the following two ways:
JUnit
's@Test
annotationexpected
parameter
Kotlin powered Spring Boot app consuming NBA Rest Api
Ladies and gents, once again I’m sharing some sample app, this time we are building sample Spring Boot app implemented in Kotlin, talking to http://data.nba.net/ API to help us get some interesting, NBA related data. In this case we’re just listing NBA teams, but you extend this sample even further.
Listing system and environment properties in Spring Boot
Ladies & Gents, I prototyped just a small app that could help you print out some basic environment related information by exposing a few Rest controller endpoints.
Microservices with Spring Boot, Netflix Zuul, Kotlin, Docker and MongoDB
Recently I've started playing with Kotlin programming language, and wanted to give it a try. Kotlin gives us possibility to write quite concise code.
Spring boot and Spring JdbcTemplate example
Let's build some simple example that demonstrate ease of Spring Boot
use when building applications that need to connect to, in this
case - MySql
database. Final output will be single - standalone jar file that can be executed as java -jar my-boot-artifact.jar
and
will be able to process http requests. Application is intentionally made simple, there's no big architecture inside it - you can see
database code inside Controller method, which you'd normally not use for real world projects.
Spring MVC JUnit testing
If you're interested in JUnit
testing your Spring
MVC
controllers, feel free to visit Github
repo
containing very simple example of Spring
MVC
controller and JUnit
test class testing it's endpoints. Project is implemented
using Spring Boot
framework.