×
DocsConsole

DocsConsole

Spring Boot Introduction

By | | Updated : 2018-09-15 | Viewed : 223 times

Spring Boot Introduction

We will know about Spring Boot introduction in this chapter. Here this article explains Spring Boot advantages over Spring framework and features of Spring Boot.

Spring Boot Introduction

Everybody knows that Spring is most popular and widely used framework for implementing the Enterprise Applications. Whenever we implement the Enterprise applications, the best choice will be the Spring. In earlier days, we had used EJB. But EJB is heavy and difficult to use. As Spring is light weight and easy to use, EJB has replaced by Spring for implementing Enterprise applications. But development of Spring applications has also some difficulties. The following difficulties are

    The Difficulties are

  • Management of XML Configuration.

  • Management of Third Party Libraries.

  • Common features for every project have to be configure.

Advantages of Spring Boot

Spring Boot has resolved above given problems.

No XML configuration is required. Spring Boot has one annotation called @SpringBootApplication. It is Combination of @EnableAutoConfiguration , @ComponentScan and @Configuration. No other XML configuration is required.

No need to handle Management of Third Party Libraries. Spring Boot contains some starter-parent jars dependencies. So these starter-parent dependency Jars will resolve all dependencies. So Third Party Libraries/Jar dependency management is handled by Spring Boot.

Note: Spring Boot will never become a replacement of Spring. It has some ease in usage.

Common features like Security, Embed servers, performance related metrics and health checks will be provided by Spring Boot.

Spring-Boot Features

  • SpringApplication class will be used for running the entire application. Here we can use run method, which is a static method, to start the application.For example: SpringApplication.run(MySpringConfiguration.class, args);

  • When application fails to start, concerned action should have to be taken. By Registering FailureAnalyzers, issue will be easily identified and rectified.

  • Spring-Boot allow us to customize the banner. Here we can add image/formatted text as banner.

  • By using the SpringApplicationBuilder, we can build the AplicationContext hierarchy.

  • The Events, which will be triggered before ApplicationContext creation, can be handled by using SpringApplication.addListeners(…) or SpringApplicationBuilder.listeners(…)

  • Springboot will determine and create right type of ApplicationContext based on scenario.

  • Spring Boot has provided ApplicationArguments interface to access the arguments. So we can use these arguments in application. These arguments will passed be from command line.

  • ApplicationRunner or CommandLineRunner is interface, which can provide the access to application arguments. Here ApplicationRunner will use the ApplicationArguments.

  • Externalized Configuration, another main feature from spring boot, will be used for different type of environments. So we can use configured properties for different environments. @Value annotation will be used for accessing the configured properties.

  • Using the @Value with different profile environments will be messed up and difficult to maintain. So Spring boot rectified with option called type Safe Configuration Properties. We can use @ConfigurationProperties annotation to define the strongly typed bean, which will be useful for configuration. It will mapped appropriated property file and converted as object properties.

  • Default logging mechanism will work perfectly with staters in spring boot.

  • With Spring Boot provided Auto configuration for Spring MVC, web application works well. So we can easily implement web application.

  • Different type of metrics, which are helpful for checking application status. Spring boot also provides these metrics.

  • Spring Boot provides CLI tool. This CLI is very helpful for creating application with ease.

We will discuss more about Spring Boot features in next chapters clearly.

Micro Services introduction

Micro Service is a Software design technique used for decomposing application into smaller micro Services. This technique will be useful for making the application as multiple micro services. So modularity of the application will be improved. If an application services are decomposed as a smaller services then maintenance will be also easy. What is decomposition of Application Services? Decomposition of application services into multiple services is called decomposition of application. Use of this modularity /separation is Each Micro Service will be easily modified and can be deployed without disturbing the other micro service. If we are implementing the application as traditional way we need to deploy entire application which will be very time consumed and costly.

Micro Services with Spring Boot

To design and implement microserivce oriented architecture application, we may need to handle given below features common for every Application. The common features for every Application are Configuration, Security, Project Deployment, Logs Management, Authentication, Embedded Servers and etc. When we design application with Micro Services then handling of these common features is not that much easy. The common features for all micro services are provided by Spring Boot. So implementation of Micro Service will become easy.

Leave A Reply