1. What is Spring Boot?

Over the years, Spring has become more complex as new features have been added. Simply visit the Spring. IO /projects page…

If we had to start a new Spring project, we had to add build paths or Maven dependencies, configure the application server, and add Spring configuration.

So starting a new Spring project takes a lot of effort, because we now have to do everything from scratch.

Spring Boot is the solution to this problem. Spring Boot is already built on top of the existing Spring framework. With Spring boot, we avoided all the boilerplate code and configuration that we had to do before.

Therefore, Spring Boot can help us use existing Spring functionality more robustly with less effort.

2. What are the advantages of Spring Boot?

  • Reduced development, testing time and effort.

  • Using JavaConfig helps you avoid using XML.

  • Avoid massive Maven imports and versioning conflicts.

  • Provide advice on developing 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 because there are no web.xml files. Simply add the class annotated with @Configuration, then add the method annotated with @Bean, and 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.

· Context-based configuration Using these properties, you can deliver the environment you are using to the application: -dspring.profiles. active = {enviorvulnerabilities}. After loading the main application properties file, Spring loads subsequent application properties files in (Application {environment}.properties).

What is JavaConfig?

The Spring JavaConfig is a product of the Spring community that provides a pure Java method for configuring the Spring IoC container. So it helps to avoid using XML configuration. The advantages of using JavaConfig are:

Object-oriented configuration. Because the configuration is defined as a class in JavaConfig, users can take full advantage of Java’s object-oriented capabilities. One configuration class can inherit from another, override its @bean methods, and so on.

Reduce or eliminate XML configuration. The benefits of externalizing configuration based on dependency injection principles have been proven. However, many developers do not want to switch back and forth between XML and Java.

JavaConfig provides developers with a pure Java way to configure a Spring container that is similar in concept to XML configuration.

Technically, it is possible to configure the container using only the JavaConfig configuration class, but in practice many people think that mixing JavaConfig with XML is ideal.

Type safe and refactoring-friendly. JavaConfig provides a type-safe way to configure the Spring container. Thanks to Java 5.0 support for generics, beans can now be retrieved by type rather than by name, without any casts or string-based look-ups.

How do I reload changes on Spring Boot without restarting the server?

This can be done using the DEV tool. With this dependency, you can save any changes and embedded Tomcat will restart.

Spring Boot has a development tools (DevTools) module that helps increase developer productivity. One of the major challenges facing Java developers is automatically deploying file changes to the server and automatically restarting the server.

Developers can reload changes on Spring Boot without having to restart the server. This will eliminate the need to manually deploy changes every time. Spring Boot did not have this feature when it released its first version.

This is the most desirable feature for developers. The DevTools module fully meets the needs of developers. This module will be disabled in production. It also provides a H2 database console to better test applications.

5. What is the monitor in Spring Boot?

Spring Boot Actuator is one of the important functions in Spring boot framework. The Spring Boot monitor helps you access the current status of running applications in your production environment.

Several metrics must be checked and monitored in the production environment. Even though some external applications may be using these services to trigger alert messages to the people concerned. The monitor module exposes a set of REST endpoints that can be accessed directly as HTTP urls to check status.

6. How to disable the SECURITY of endpoints in Spring Boot?

By default, all sensitive HTTP endpoints are secure, and only users with ACTUATOR roles can access them.

Security is the use of standard it. IsUserInRole method implementation. We can use management. Security. Enabled = false to disable security. Disabling security is recommended only if an actuator endpoint is accessed behind a firewall.

How do I run a Spring Boot application on a custom port?

To run Spring Boot applications on custom ports, you can specify ports in application.properties.

server.port = 8090

7. What is YAML?

YAML is a human-readable data serialization language. It is usually used for configuration files.

Compared to properties files, YAML files are more structured and less confusing if we want to add complex properties to a configuration file. You can see that YAML has hierarchical configuration data.

8. How to implement Spring Boot application security?

To implement Spring Boot security, we use the spring-boot-starter-security dependency and must add a security configuration. It requires very little code. Configuration class will must extend WebSecurityConfigurerAdapter and override the method.

9. How to integrate Spring Boot and ActiveMQ?

For integrating Spring Boot and ActiveMQ, we use spring-boot-starter-ActivemQ

Dependencies. It requires very little configuration and no boilerplate code.

10. How to use Spring Boot to implement paging and sorting?

Using Spring Boot to implement paging is simple. Using Spring Data – JPA will can implement paging org. Springframework. Data. Domain. Pageable passed to the repository.

The last

Spring series of study notes and interview questions, including Spring interview questions, Spring Cloud interview questions, Spring Boot interview questions, Spring Tutorial notes, Spring Boot tutorial notes, 2020 Java Interview Manual. A total of 1184 pages of PDF documents were organized.

Pay attention to the public account: Qiaoqiuguang, get this 1184-page PDF file of Spring family bucket information.