preface

Spring Boot is a new framework from the Pivotal team designed to simplify the initial setup and development process for new Spring applications. The framework uses a specific way to configure so that developers no longer need to define boilerplate configurations. Spring Boot is considered the “successor” to Spring MVC. It can automatically configure for us, and if the default configuration does not meet our requirements, we can replace the auto-configuration class and use our own configuration. In addition, Spring Boot also integrates embedded Web servers, system monitoring, and many other useful features, allowing us to quickly build enterprises and applications.

What is a SpringBoot?

Spring Boot makes it easy to create standalone, production-level Spring-based applications that you can “run.” Most Spring Boot applications require minimal Spring configuration.

SpringBoot features?

  • Create a stand-alone Spring application
  • Embed directly into Tomcat, Jetty, or Undertow (no need to deploy WAR file)
  • Provide hardened “starter” dependencies to simplify build configurations
  • Automatically configure Spring and 3rd Party libraries whenever possible
  • Provides production-ready functionality, such as metrics, health checks, and externalized configuration
  • There is no code generation and no XML configuration required

How to quickly build a SpringBoot project?

  • Using the Web UI. start.spring.io
  • Use through Spring Tool Suite.
  • Used through IntelliJ IDEA.
  • Use the Spring Boot CLI.

What is the principle of Spring Boot automatic configuration?

@enableAutoConfiguration, @Configuration, and @conditionalonClass are at the heart of automatic Configuration. @enableAutoConfiguration imports the auto-configuration classes defined in meta-INF/Spring. factories into the container. Filter valid auto-configuration classes. Each automatic configuration class is combined with the corresponding xxxproperties.java to read configuration files for automatic configuration

How do you understand the Spring Boot configuration loading order?

In Spring Boot, you can load configurations in the following ways.

1) Properties file;

2) YAML files;

3) System environment variables;

4) Command line parameters;

Need small partners can click: point me point me, code: JJ

SpringBoot boot class annotations? What annotations does it consist of?

@SpringBootApplication

  • @ SpringBootConfifiguration: combination of @ Confifiguration annotations, realize the function of the configuration file.
  • @ EnableAutoConfifiguration: open the function of automatic configuration, also can turn off an automatic configuration options.
  • @SpringBootApplication(exclude = { DataSourceAutoConfifiguration.class })
  • @ComponentScan:Spring component scanning

Yaml is what?

YAML (/ˈjæməl/, ending like camel camel) is a readable format for data serialization. YAML references many other languages, including C, Python, and Perl. It’s more structured.

SpringBoot configuration path?

  1. Command line arguments
  2. Java: JNDI properties in comp/env
  3. JVM System Properties
  4. Operating system environment variables
  5. Randomly generated attributes prefixed with random.* (they can be referenced when setting other attributes, such as ${random.long})
  6. Properties or appliaction.yml file outside the application
  7. Application. properties or appliaction.yml file packaged within the application
  8. Annotated PropertySource via @propertysource
  9. The default attribute

Tips: This list is sorted by priority, meaning that any property set in a high-priority property source overrides the same property set in a low-priority property source.

Does Spring Boot need a separate container to run?

You don’t need it, Tomcat/ Jetty containers are built in.

What are the ways to enable Spring Boot?

1. Inherit the spring-boot-starter-parent project

2. Import the spring-boot-dependencies dependencies project

How can SpringBoot implement hot deployment?

Hot deployment is the ability to automatically update the operating background code to the running project without having to re-run the SpringBoot project

There are two main ways:

Spring Loaded

Spring-boot-devtools

conclusion

To this xiaobian to share the interview question is over! The above interview questions and answers are xiaobian organized for a long time into the interview document and spring Series organized mind map, as well as spring Boot learning notes more than 100 pages of the complete tutorial you need to get friends can click on me for free, here xiaobian wishes to go to the big factory interview students, start a successful journey. Offer cramps in hand.

There are also Java core knowledge points + a full set of architect learning materials and videos + a top factory interview treasure book + interview resume template can be collected