Understand springboot

  1. What is a SpringBoot?
  2. Springboot is an easy way to quickly use the Spring framework, which is a subproject of the Spring project
  3. Why learn SpringBoot?
  4. Java has been criticized for being bloated and cumbersome. While we are still working on the project, other frameworks may have been written. There are two reasons for this:
  5. Complex configuration
  6. One is messy dependency management
  7. And Springboot makes that a thing of the past!

The main objectives of Spring Boot are: Providing a very fast, widely accepted starter experience for all Spring developers, SpringBoot is an easy way to quickly use the Spring framework right out of the box, but quickly get out of it by setting your own parameters Provides non-functional features in large projects such as embedded servers, security, metrics, health checks, external optimization configurations, etc.

@configuration public class MyConfig {@bean @configurationProperties (prefix = “user”) Public User createUser(){User User = new User(); return user; }} code slice @springBootConfiguration

Conclusion:

SpringBoot provides us with a default configuration, which takes effect in the following steps: The @enableAutoConfiguration annotation looks for the meta-INF/Spring. factories file and reads the names of all the classes with EnableAutoConfiguration as key. These classes are pre-written auto-configuration classes

These classes declare the @Configuration annotation and pre-configure all the instances we need through the @Bean annotation. Complete automatic configuration

However, the configuration does not necessarily take effect, as @conditionalon makes it conditional. For example, one condition is that some related classes exist

In order for the class to exist, we only need to introduce the dependency (initiator), the dependency condition is valid, automatic configuration takes effect.

If we configure the related beans ourselves, the default auto-configured beans will be overridden

We can also override the properties in automatic configuration by configuring the application.properties file

Explore and learn more about Java expertise: Good Knowledge Education

Understand employment, career planning, interview, training institutions related to the dry goods search: IT brother

— — — — — — — —

Copyright notice: This article is originally published BY CSDN blogger “I’m waiting for you”. It follows CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement. Original link: blog.csdn.net/qq_44912827…