From the Internet to organize their own face questions about the SpringBoot
Article Directory
- What 1.SpringBoot that?
- 2. Why SpringBoot (advantage)?
- 3.SpringBoot core configuration files and which of? What is the difference between them?
- 4.SpringBoot configuration file, which has several formats? the difference?
- 5.SpringBoot core notes Which?
- 6. Turn SpringBoot characteristics, which has several ways?
- 7.SpringBoot requires a separate container to run it?
- 8. What are the different ways to run SpringBoot?
- What 9.SpringBoot automatic configuration principle?
- 10.SpringBoot directory structure is kind of how?
- 11. How do you understand SpringBoot of Starters?
- 12. How to run some specific code when SpringBoot start?
- What kinds of methods to read the configuration of 13.SpringBoot there?
- Which log architecture 14.SpringBoot support? Recommended and default log architecture is which?
- 15.SpringBoot achieve hot deployment, which has several ways?
- 16.SpringBoot configured load order?
- 17.SpringBoot how to define different sets of environment configuration?
- 18.SpringBoot compatible with the old Spring project?
- 19. What protective SpringBoot application?
- 20.SpringBoot2.X What's new special new? And the difference between the 1.X?
What 1.SpringBoot that?
SpringBoot is a sub-project of the Spring open source organizations, is Spring component stop solution, the main difficulty is to simplify the use of Spring, Jane, heavy configuration, offers a variety of starters, developers can quickly get started.
2. Why SpringBoot (advantage)?
- Operate independently
- Simplified configuration
- Automatic Configuration
- XML configuration and no code generation
- Application Monitoring
- Good easy
- ...
in two ways, on one hand: the frame itself advantage (independent, reduced configuration), on the other hand: the angle of the user (started)
3.SpringBoot core configuration files and which of? What is the difference between them?
application and Bootstrap
application is mainly used for automated configuration SpringBoot project.
bootstrap configuration file scenarios:
- When using Spring Cloud Config distribution center, then you need to add a connection configuration properties of the configuration center to load the configuration information in the external configuration of the central bootstrap configuration file;
- Some fixed attributes not covered;
- Some encryption / decryption of the scene;
4.SpringBoot configuration file, which has several formats? the difference?
.properties and .yml, differences: writing format
. 1) .properties
app.user.anme = navastack
- .yml
app:
user:
name:javastack
* In addition, .yml format does not support @PropertySource notes Import Configuration
5.SpringBoot core notes Which?
Start class above comment is @SpringBootApplication, it is also SpringBoot core notes, mainly contain the following three notes:
@SpringBootConfiguration: a combination of @Configuration annotation, functional configuration file.
@EnableAutoConfiguration: Open autoconfiguration function can also turn off an option automatically configured, such as closing a data source autoconfiguration;
@SpringBootApplication (DataSourceAutoConfiguration.class the exclude = {}).
@ComponentScan: the Spring component scans
6. Turn SpringBoot characteristics, which has several ways?
- Inheritance spring-boot-starter-parent project
- Spring-boot-dependencies introduced project dependencies
7.SpringBoot requires a separate container to run it?
May not be required, it built Tomcat / Jetty like container
8. What are the different ways to run SpringBoot?
- Command or run into packaging containers
- Run with Maven / Gradle plugin
- Direct execution main method runs
What 9.SpringBoot automatic configuration principle?
Notes ** @ EnalbeAutoConfiguration, @ Configuration, @ ConditionOnClass ** is the core of automatic configuration, first it must have a configuration file, and secondly whether there is automatically configured according to the class to the classpath
10.SpringBoot directory structure is kind of how?
cn
+- javastack
+- MyApplication.java
|
+- customer
| +- Customer.java
| +- CustomerController.java
| +- CustomerService.java
| +- CustomerRepository.java
|
+- order
+- Order.java
+- OrderController.java
+- OrderService.java
+- OrderRepository.java
The directory structure is the mainstream and recommended practices, and in the main entrance class above plus ** @ SpringBootApplication ** open the annotation capability SpringBoot, such as automatic configuration, scanning and other components. Directory Structure
11. How do you understand SpringBoot of Starters?
Starters starter, contains a series of applications which can be formed into dependencies, one-stop succession Spring and other technologies. If you want to use the Spring JPA to access the database, just add spring-boot-starter-data-jpa starter depend ready to use.
12. How to run some specific code when SpringBoot start?
Can implement an interface ApplicationRunner or CommandLineRunner, two implementations of the same interfaces, provides the run method.
What kinds of methods to read the configuration of 13.SpringBoot there?
@PropertySource
@Value
@Environment
@ConfiguratoinProperties
Which log architecture 14.SpringBoot support? Recommended and default log architecture is which?
Support ** Java Util Logging, Log4j2, Lockback ** as logging framework, if Starters starter, SpringBoot default Logback
15.SpringBoot achieve hot deployment, which has several ways?
- Spring Loaded
- Spring-boot-devtools
16.SpringBoot configured load order?
- properties file
- YAML file
- System environment variables
- Command line parameters
17.SpringBoot how to define different sets of environment configuration?
applcation.properties
application-dev.properties
application-test.properties
application-prod.properties
18.SpringBoot compatible with the old Spring project?
Compatible, use @ImportResource annotation project to import old Spring configuration file
19. What protective SpringBoot application?
- Use HTTPS in production
- Use Snyk check your dependencies
- Upgrade to the latest version
- Enable CSRF protection
- Use content security policy placed XSS attacks
- 。。。。。
20.SpringBoot2.X What's new special new? And the difference between the 1.X?
- Configuration changes
- JDK version upgrade
- Third-party libraries upgrades
- Spring responsive programming support
- HTTP / 2 support
- Binding Configuration Properties
- 。。。。