If you ever worked on a large project which doesn’t have any tests then you know how painful it is to work on such codebase. You know what is more painful? Working on a project which has plenty of USELESS tests written for the sake of passing minimum code coverage requirement. Being a Professional Software Developer means more than solving a problem. One needs to learn how to write maintainable and testable code, write meaningful tests, know what to test and what not to test, how to evolve the codebase backing with a good set of test suite.
Continue reading »LocalStack SpringBoot Starter Tutorial
I was working on a SpringBoot application which is planned to deploy on AWS and, we were using S3, SQS and RDS services. LocalStack provides an easy-to-use test/mocking framework for developing AWS based Cloud applications. I want to use Localstack mock services instead of using real AWS services for two purposes: To run integration tests To run application locally We can use Testcontainers to spin up a Localstack docker container, but we need to configure Amazon service clients like AmazonS3, AmazonSQSAsync which is typical boilerplate that we copy-paste from project to project.
Continue reading »All the resources you ever need as a Java & Spring application developer
Nowadays software development is a challenging task as the number of programming languages, frameworks, libraries are increasing rapidly day by day. Luckily, the number of resources to learn on the internet for free also increased a lot. There are a ton of free resources to learn almost everything on the internet. There are lots of official documentation, blog posts, Udemy courses, YouTube videos etc. As a backend developer who primarily work on JVM based languages/frameworks like Java, Kotlin, SpringBoot etc, following are a collection of resources I usually follow to learn new things.
Continue reading »Testing SpringBoot Applications
SpringBoot is the most popular tech stack for building Java based REST APIs. In this tutorial we will learn how to write tests for SpringBoot applications. Create SpringBoot Application Unit Testing using JUnit 5 and Mockito Integration Testing using TestContainers Testing MicroService Integrations using MockServer As we all know, we write unit tests for testing single component (a class) behaviour where as we write integration tests for testing a feature which may involve interaction with multiple components.
Continue reading »Kafka Tutorial - Producer and Consumer using SpringBoot
In the previous post Kafka Tutorial - Java Producer and Consumer we have learned how to implement a Producer and Consumer for a Kafka topic using plain Java Client API. In this post we are going to look at how to use Spring for Kafka which provides high level abstraction over Kafka Java Client API to make it easier to work with Kafka. You can find the source code for this article at https://github.
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 »Retrying Method Execution using Spring AOP
One of my blog follower sends an email asking me to show an example of “RealWorld Usage of Spring AOP”. He mentioned that in most of the examples the usage of Spring AOP is demonstrated for logging method entry/exit or Transaction management or Security checks. He wanted to know how Spring AOP is being used in “Real Project for Real Problems”. So I would like to show how I have used Spring AOP for one of my project to handle a real problem.
Continue reading »Selecting The Technology Stack for JCart
Selecting the right technology stack is very crucial and plays an important role in project success. Many of the architects (unknowingly??!!) try to make complex designs by trying to use all kinds of latest and greatest stuff. On the other hand some architects try to be in their comfort zone by limiting their technology stack to the technologies with which they are comfortable. Both approaches are dangerous. One should understand the business needs and pick the technologies that are necessary for project.
Continue reading »Developing a simple e-commerce application from scratch to production using SpringBoot
We can find plenty of information on any technical topic, be it Java, .NET, Python or any frameworks like Spring, Hibernate, CDI, JSF etc. You can find hundreds of well written blogs on many of these topics. For example, you can find lot of tutorials on how to use SpringBoot or how to use various mappings in JPA/Hibernate or how to do form validations in JSF etc. Also, there are plenty of books published by well established publishers on most of the technologies.
Continue reading »