Posts

Code Analysis using SonarScanner on Windows 10

Image
In my previous blog , we have already seen how to setup SonarQube server on Windows 10. In this blog, I’ll show you how to generate sonar report using SonarScanner.  Step to setup SonarQube Download SonarScanner from https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/ . Set SonarScanner to PATH under Environment Variable. Unzip it and open sonar-scanner.properties which are under conf directory. Edit the below lines Now, go to your project folder directory, open command prompt and run sonar-scanner.bat. It will do the analysis and then post the result to the SonarQube server http://locathost:9000/ having the project name as sonar key that we have configured in sonar-scanner.properties file. You can check the JUnit test code coverage as well by clicking on Coverage. Happy Coding..!!!

SonarQube setup on windows 10

Image
Overview SonarQube is an automatic code review tool to detect bugs, vulnerabilities and code smell in your code. It can integrate with your existing workflow to enable continuous code inspection across your project branches and pull requests.  Prerequisite Make sure you have JAVA 11 or higher version installed on your window machine. Step to setup SonarQube Download Community edition from https://www.sonarqube.org/downloads/ Extract it and go to the bin folder. Choose windows-x86–32 or windows-x86–64 based on your machine configuration. Run StartSonar.bat which will start the SonarQube server.  Open browser and hit http://localhost:9000 If you want, you can start the sonarQube server to a different port by just updating the port number (sonar.web.port=9070) to sonar.properties which is present under conf directory. You can login to the portal using default credential (admin:admin). Congratulation! SonarQube server is up and running on loca...

Postman API – Tips and Tricks

Image
I have seen many people using POSTMAN tools but very few of them know how to exactly use all the features of POSTMAN application. So, in this article, I am going to share a few tips/tricks which can be really helpful in our API testing. Set Environment Variables Let’s assume we have an endpoint to get some data after authenticating yourself bypassing username/password. Now, you have to test this endpoint which is deployed on multiple environments like a local machine, test environment and on SIT environment as well. Also, the credential is different for each environment. So, how are we going to test it? Most of the time, I have seen that people create one-one requests for each environment or create one request and then modify the existing username/password and hostname to point to a different environment. The Simple Solution is to set changing parameters as an Environment variable and switch environment to test for different regions. E.g.  http://<HOSTNAME:POST>/t...

Spring Boot Tutorial

Prerequisite: Basic knowledge of Spring boot application I am working on a series of implementing frameworks with Spring boot application but not getting enough time to blog it and post it here or on my LinkedIn profile. So, I have started uploading my work on my GitHub repository from where it can be downloaded easily. I tried my best to add short notes for each annotation/configuration/properties in README and even I have uploaded a few screenshots to understand in a more better way. Try it out and Please do let me know in case of any confusion. Spring Boot Actuator Spring Boot Ehcache Spring Boot Swagger Spring Boot JPA Will keep uploading with others framework as well. Feedback is also most welcome. Thank you. Happy Learning!

MicroServices: Spring cloud ribbon with Discovery Server

Image
In this article, I am going to share my knowledge on Spring Cloud Ribbon and how can we use Ribbon with RestTemplate as well as with Feign Client. We will also see how Enabling discovery Sever will improve the scalability of Microservice. Before jumping into Spring Cloud, I am assuming you must be having knowledge of Eureka Server, Feign Client, and Client-Side load balancer. If not then read my below blog before jumping to Spring Cloud ribbon. Also, I am going to use my existing code to implement Ribbon . URLs: Declarative REST Client: Feign Microservices: Service Registry and Discovery Netflix Hystrix Circuit Breaker In my previous blog, I have already talked about the Eureka Server and how other applications are taking advantages of Eureka Server to fetch the host/port of client application. We have seen that three microservices application are up and running i.e. Discovery Server Product Service Price Service Where Product and Price service will register themselves to...

Declarative REST Client: Feign

Image
We already know that how microservices communicate with each other using RestTemplate. In this blog, we will see that how this can happen using Feign Client as well.  What is a Feign Client? Feign is an abstraction over REST based call. It makes writing web service clients easier. It Is as easy as creating interface and then annotate it. It has pluggable annotation support including Feign annotations and JAX-RS annotations. It also supports pluggable encoders and decoders and has supports for Spring MVC annotation. Using Feign, microservices can easily communicate with each other and developers don't have to bother about REST internal details and can only concentrate on business logic. Implementation. I am going to use my previous applications to demonstrate the working of Feign Client. So before starting feign-client application. Make sure all the below three applications are already up and running.  Discovery-server Product-server Price-server Feign Client Impl...

Microservices: Service Registry and Discovery

Image
In my previous blog, I have already talked about Netflix Hystrix Circuit Breaker Microservices and explained it by creating two applications i.e. Product Service and Price Service. In this post, I’ll use both applications to explain what is the Service Registry and Discovery Server. Circuit Breaker and Microservices Architecture Netflix Hystrix Circuit Breaker   What is Service Registry and Discovery and why do we need it in the first place? In our monolithic application, mostly service invoke one another through language methods or procedure calls and even in traditional distributed system deployment, services run at fixed, well-known locations (hosts and ports) and so can easily call one another using HTTP/REST. Over here the network locations of service instances are relatively static. With the microservice architecture system, this is a much more difficult problem as service instances have dynamically assigned network locations. Service instances change dynamicall...