Learnitweb

Category: Spring Boot

  • @SpringBootApplication annotation in Spring Boot

    @SpringBootApplication annotation is usually used to annotate class which contains main method. It is a convenient annotation which serves the purpose of enabling following three features: @EnableAutoConfiguration: This annotation enables auto-configuration in application. @ComponentScan: This annotation enables scan of @Component classes in the package where the application is located. @SpringBootConfiguration: This annotation enables import of…

  • Auto-configuration and disable auto-configuration in Spring boot

    1. Introduction Auto-configuration of Spring Application Context automatically configures the beans which are likely to be needed in application development. We use @EnableAutoConfiguration annotation for auto-configuration. We generally use @SpringBootApplication annotation in a Spring application, and this annotation enables the auto-configuration of the context automatically. So there is no additional use of using @EnableAutoConfiguration with…

  • Importing XML configuration in Spring Boot

    Spring Boot recommends Java-based configuration. However, it is possible to load beans from XML sources. The best practice is to put all configuration in a single class. Usually the class with main method is considered best to put all configuration and is annotated with @Configuration. Additional configuration resources from XML can be imported using @ImportResource…

  • Dependency management and starters in Spring Boot

    Every Spring Boot version comes with a curated list of dependencies that it supports. These dependencies are upgraded when we upgrade the version of Spring Boot. Since these dependencies are kind of predefined and come with Spring Boot, we do not have to provide the version of dependencies in build configuration. It is not compulsory…

  • Bootstrap a simple application in Spring Boot

    1. Introduction This tutorial can act as a starting point if you are starting Spring Boot. In this tutorial, we’ll create a very simple application in Spring Boot. We’ll create a simple REST service which returns a message “Hello World”. To create REST service, we’ll use start.spring.io. There are other ways to create a Spring…

  • Introduction to Spring Boot

    According to the official documentation: Spring Boot helps you to create stand-alone, production-grade Spring-based applications that you can run. Why Spring Boot? If you getting started with Spring framework, it may take some time to create production-grade application. Those who have worked with Spring can tell that configuring right set of dependencies takes some time…