In this article we will talking about Spring Boot life cycle hooks and where we would use them.
We will covering below topics,
What is a Bean in Spring Boot ?
Its an object that is created and managed by Spring IOC. Basically any object managed by ApplicationContext class of Spring is called a Bean.
What is Bean Life Cycle ?
The spring Bean life cycle is as follows,
As more and more applications move towards platform-as-a-service(PAAS), many companies are looking to migrate from Spring MVC to Spring Boot.
Migrating from Spring MVC to Spring Boot involves quite a few changes affecting the entire application.
In this article I will explain my experience on migrating Spring MVC to Spring Boot in my current company and the issues I faced doing the same.
1. POM Changes First thing to do, is the POM changes.
Spring Boot comes with build-in logging functionality and its very easy to integrate.
Logback Spring Boot uses logback logging framework. Logback in an upgrade of log4j framework.
It comes bundled with spring boot starter packs. For example if we using spring web service, then logback comes bundled with it.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web-services<actifactId> </dependency> Implementation To use logging in a Java class use below code
Logger logger = LoggerFactory.getLogger(getClass()); logger.error("This is an error"); That’s it !
When dealing with large amounts of data in a front-end application, we often need to break it down to smaller chucks so as to not overwhelm the user. Hence in front-end application we display large chucks of data as pages. Using this technique, we can request only required data for displaying only a single page at a time. To achieve this, we require pagination in API requests
Spring boot makes it easy to setup pagination with hibernate.
Imagine you and your buddy are developing a Spring boot Rest application using Java 11. To make it run consistently in yours and your buddy’s machine you decide to setup Sprint boot jar in Docker.
Now the docker setup is done, you want to release it to world and announce it in Product hunt.
Out of many cloud provider like AWS, Google cloud; Heroku is the most beginner friendly, whilst offering advanced features which can be scaled for a production level application.
So, you’ve developed your Spring Boot rest API and generated the war. You’ve even managed to successfully deploy it in a tomcat server.
Now you’re thinking of containerizing your application.
This blog will guide you in deploying spring boot war to docker image.
Docker Intro Docker is a platform-as-a-service tool (PAAS) that provides virtualization on OS level called containers. It uses some common OS libraries but overall each container is isolated from one another.
In modern Sass applications, a single application can be used by multiple companies(tenant). There are three ways with which one can divide an application by,
Single schema and a single DB instance Separate Schema for each company but single DB instance Different DB instances for each Company In this article, we will be looking into the second method , i.e Separate Schema for each tenant or company using Spring Boot.