In the microservices world, Service Registry and Discovery plays an important role because we most likely run multiple instances of services and we need a mechanism to call other services without hardcoding their hostnames or port numbers. In addition to that, in Cloud environments service instances may come up and go down anytime. So we need some automatic service registration and discovery mechanism. Spring Cloud provides Service Registry and Discovery features, as usual, with multiple options.
Continue reading »MicroServices - Part 2 : Configuration Management with Spring Cloud Config and Vault
In MicroServices using Spring Boot & Spring Cloud – Part 1 : Overview, we took a brief look at what are micro-services and how we can use SpringBoot and SpringCloud to build micro-services. In this post, we are going to learn: What is the need for Spring Cloud Config and Vault? Create our first micro-service: catalog-service Create Spring Cloud Config Server Using Vault for storing sensitive data MicroServices using Spring Boot & Spring Cloud
Continue reading »MicroServices using Spring Boot & Spring Cloud – Part 1 : Overview
Nowadays MicroServices is the hot buzzword in software development and many organizations prefer building their enterprise applications using MicroServices architecture. In Java community, SpringBoot is the most widely used framework for building both monoliths and microservices. I am planning to write a series of articles covering how to build microservices using SpringBoot and SpringCloud. In this article we are going to learn about following: Monoliths what are MicroServices? Advantages of MicroServices Challenges with MicroServices Why SpringBoot & SpringCloud are a good choice for MicroServices?
Continue reading »Why SpringBoot is so popular and how to learn SpringBoot effectively?
SpringBoot is the most popular and widely used Java framework. Occasionally this discussion of “Why is SpringBoot so popular?” come between me and my friends/colleagues. Also, I do get emails from various people asking “Spring is huge and how to learn it quickly?”. In this post, I will try to answer these 2 questions. Why is SpringBoot so popular? There could be many reasons why Spring and SpringBoot are very popular, but in my opinion following are the key reasons:
Continue reading »SpringBoot Messaging with RabbitMQ
RabbitMQ is one of the popular message broker solutions and provides client libraries to be used from various programming languages including Java, Scala, .NET, Go, Python, Ruby, PHP etc. In this tutorial, we will learn how to use RabbitMQ message broker to send and receive messages from a SpringBoot application. We will also look at how to send messages as JSON payloads and how to deal with errors using Dead Letter Queues (DLQ).
Continue reading »Session Management using Spring Session with JDBC DataStore
In web applications, user session management is very crucial for managing user state. In this article, we are going to learn about what are the approaches we have been following to manage user sessions in a clustered environment and how we can use Spring Session to implement it in a much simpler and more scalable way. Typically in production environments, we will have multiple server nodes with a load balancer in front of them and all the client traffic will be coming through the load balancer to one of the server nodes.
Continue reading »CI/CD for SpringBoot applications using Travis-CI
In this article we are going to learn how we can use Travis CI for Continuous Integration and Continuous Deployment (CI/CD) of a SpringBoot application. We will learn how to run maven build goals, perform test coverage validation using JaCoCo plugin, Code Quality checks using SonarCloud, build Docker image and push it to DockerHub and finally deploy it to Heroku. The source code for this article is at https://github.com/sivaprasadreddy/jblogger Last week I was talking to my friend about how easy it became to build a Java application and deploy it using SpringBoot.
Continue reading »Select ALL starters on Spring Initializer (http://start.spring.io)
If you are working on Spring Boot then you most probably aware of Spring Initializer (http://start.spring.io) which is an online spring boot application generator. You can select the starters that you want to use and then generate the application. If you notice that there is no SELECT ALL option to select all the starters. Who would do that insane thing of selecting all the starters for an application??!!??? But, i would like to have the SELECT ALL option for one single reason:
Continue reading »Spring Cloud Tutorials – Auto Refresh Config Changes using Spring Cloud Bus
Problem In the previous article Introduction to Spring Cloud Config Server we have seen how to use Spring Cloud Config Server. But, the problem is to reload the config changes in Config Client applications we need to trigger /refresh endpoint manually. This is not practical and viable if you have large number of applications. Solution Spring Cloud Bus module can be used to link multiple applications with a message broker and we can broadcast configuration changes.
Continue reading »Spring Cloud Tutorials – Introduction to Spring Cloud Config Server
Problem SpringBoot provides lot of flexibility in externalizing configuration properties via properties or YAML files. We can also configure properties for each environment (dev, qa, prod etc) separately using profile specific configuration files such as application.properties, application-dev.properties, application-prod.properties etc. But once the application is started we can not update the properties at runtime. If we change the properties we need to restart the application to use the updated configuration properties.
Continue reading »