Zipkin is very efficient tool for distributed tracing in microservices ecosystem. Distributed tracing, in general, is latency measurement of each component in a distributed transaction where multiple microservices are invoked to serve a single business usecase. Let’s say from our application, we have to call 4 different services/components for a transaction. Here with distributed tracing […]
Learn to create load balancer using Netflix Zuul and its solid bonding with Spring Cloud. Here we will mainly concentrate on API gateway pattern and it’s usage. We will build a demo where we will create a microservice ecosystem and test its effectiveness and applicability of Zuul API gateway in the whole ecosystem.
Learn to create Microservices, based on Spring cloud, registering on HashiCorp Consul registry server and how other microservices (discovery clients) use it to register and discover services to call their APIs.
Learn to leverage the one of the Spring cloud Netflix stack component called Hystrix to implement circuit breaker while invoking underlying microservice. It is generally required to enable fault tolerance in the application where some underlying service is down/throwing error permanently, we need to fall back to different path of program execution automatically. This is […]
Learn to create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework, and add role based security using JAX-RS annotations e.g. @PermitAll, @RolesAllowed or @DenyAll. Table of Contents Project Structure Create REST APIs Secure REST APIs with JAX-RS Annotations Write security filter using JAX-RS ContainerRequestFilter Demo Project Structure The project structure of application created […]
Learn to configure and create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework. This example application uses Jersey’s ServletContainer to deploy the REST APIs.
Learn to deploy and host spring boot applications into Pivotal Cloud Foundry Web Services Platform (PWS) and access REST endpoint from local workstation.
Learn to create microservice, based on Spring cloud, which act as Netflix Eureka registry server and how other microservices (Eureka clients) use it to register and discover services.
Learn to configure Spring boot application with embedded ActiveMQ for sending and receiving JMS messages with help of JMSTemplate.
Config server is where all configurable parameters of microservices are written are maintained. It is more like externalizing properties / resource file out of project codebase to an external service altogether, so that any changes to that property does not necessitate the deployment of service which is using the property. All such property changes will be reflected without redeploying the microservice.
PropertyEditor is originally part of the JavaBeans specification. Spring also heavily uses the PropertyEditors to be able to represent properties in a different way than the object itself e.g. parsing human readable inputs from http request params or displaying human readable values of pure java objects in view layer. Spring has a number of built-in […]
To schedule job in spring boot application to run periodically, spring boot provides @EnableScheduling and @Scheduled annotations. Lets learn to use them. Let’s say you want to run job at every 10 seconds interval. You can achieve this job scheduling in below steps: 1) @EnableScheduling to Spring Boot Application class Add @EnableScheduling annotation to your […]
Spring boot’s CommandLineRunner interface is used to run a code block only once in application’s lifetime – after application is initialized. How to use CommandLineRunner You can use CommandLineRunner interface in three ways: 1) Using @Component over CommandLineRunner implementation class This one is fairly easy. 2) Implement CommandLineRunner in SpringBootWebApplication itself This is also possible. […]
Spring boot loads lots of beans internally to run your application with minimal configuration. In this example, we will learn to find out all those spring boot loaded beans and their class type information. Using ApplicationContext to get all loaded beans To execute a method automatically, when application is fully loaded, I am using CommandLineRunner […]
Learn spring boot logging configuration via application.yml file in simple and easy to follow instructions. In the default structure of a Spring Boot web application, you can locate the application.yml file under the resources folder. Table of Contents Understand default spring boot logging Set logging level Set logging pattern Set logging output to file Using […]
Learn spring boot logging configuration via application.properties file in simple and easy to follow instructions. In the default structure of a Spring Boot web application, you can locate the application.properties file under the resources folder. Table of Contents Understand default spring boot logging Set logging level Set logging pattern Set logging output to file Using […]
By default, Spring boot uses embedded tomcat server to run the application. At times, you may need to use jetty server in place of tomcat server. Spring Boot provides Tomcat and Jetty dependencies bundled together as separate starters to help make this process as easy as possible. You can use jetty with following simple steps. […]
By default, Spring boot applications started with embedded tomcat server start at port 8080. You can change default tomcat port to any other port, using any one of below technique. 1) Change default server port from application.properties file You can do lots of wonderful things by simply making few entries in application.properties file in any […]
By default, Spring boot applications are accessed by context path “/” which is default for embedded servers i.e. you can access the application directly at http://localhost:PORT/. But in production, you will deploy the application under some context root – so that you can refer the URLs for other places. Also, it is desirable to configure […]
Learn to create and configure spring boot application which uses JSP template files to render view layer. It uses embedded Tomcat server to run the application. Sourcecode Structure The files in this application are placed as given structure in image. Maven dependencies – pom.xml This application uses given below dependencies. Spring Boot Application Initializer The […]