Skip to main content

8 posts tagged with "spring-boot"

View All Tags

· 6 min read

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.

· 5 min read

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.