Xiaodi Classroom industrial-grade Paas cloud platform + Spring Cloud Alibaba + jdk11 integrated project actual combat

1. What is Spring Boot?

Spring Boot is a sub-project under the Spring open source organization. It is a one-stop solution for Spring components. It mainly simplifies the difficulty of using Spring, saves heavy configuration, provides various starters, and developers can quickly get started.

2. What are the advantages of Spring Boot?

Reduce development and testing time and effort.
Using JavaConfig helps to avoid the use of XML.
Avoid a large number of Maven imports and various version conflicts.
Provide advice on development methods.
Start development quickly by providing default values.
No separate web server is required. This means you no longer need to start Tomcat, Glassfish or anything else.
Less configuration is required because there is no web.xml file. Just add the class annotated with @Configuration and then add the method annotated with @Bean, Spring will automatically load the object and manage it as before. You can even add @Autowired to the bean method to make Spring automatically load the required dependencies. Using these properties for environment-based configuration, you can pass the environment you are using to the application: -Dspring.profiles.active = {enviornment}. After loading the main application property file, Spring will load the subsequent application property file in (application{environment}.properties).

3. What are the core configuration files of Spring Boot? What is the difference between them?

The core configuration files of Spring Boot are application and bootstrap configuration files.
The application configuration file is easy to understand and is mainly used for automatic configuration of Spring Boot projects.
The bootstrap configuration file has the following application scenarios.
When using the Spring Cloud Config configuration center, you need to add configuration attributes connected to the configuration center in the bootstrap configuration file to load the configuration information of the external configuration center; some fixed attributes that cannot be overwritten; some encryption/decryption scenarios

4. What are the formats of Spring Boot configuration files? What is the difference between them?

The difference between v.properties and .yml is mainly in the writing format.

1 , properties

app.user.name = javastack
2, yml

app:
user:
name: javastack
5. What is the core annotation of Spring Boot? Which annotations are mainly composed of?

The annotation above the startup class is @SpringBootApplication, which is also the core annotation of Spring Boot. The main combination includes the following 3 annotations:
1. @SpringBootConfiguration: Combines the @Configuration annotation to realize the function of the configuration file.
2.@EnableAutoConfiguration: Turn on the automatic configuration function, you can also turn off a certain automatic configuration option, such as turning off the data source automatic configuration function: @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }).
3.@ComponentScan: Spring component scan.

6. What are the ways to enable Spring Boot features?

1. Inherit the spring-boot-starter-parent project
2. Import the spring-boot-dependencies project dependencies

7. Does Spring Boot need a separate container to run?

No need, built-in containers such as Tomcat/ Jetty.

8. What are the ways to run Spring Boot?

1. Pack and run with commands or put in a container
2. Run with Maven/ Gradle plug-in
3. Directly execute the main method to run

9. What is the principle of Spring Boot automatic configuration?

Annotation @EnableAutoConfiguration, @Configuration, @ConditionalOnClass is the core of automatic configuration. First, it must be a configuration file, and secondly, it is automatically configured according to whether there is this class in the class path.

10. What are the new features of Spring Boot 2.X? What is the difference with 1.X?

Configuration change
JDK version upgrade
Third-party class library upgrade
Reactive Spring programming support
HTTP/2 support
Configuration attribute binding
More improvements and enhancements...
11, How to use Spring Boot to achieve paging and sorting?

Guess you like

Origin blog.csdn.net/weixin_52772147/article/details/111939939