Java – learn about spring boot

I try to understand the difference between spring boot and spring boot web Starting from this boot tutorial, POM includes spring boot as the parent and spring boot web as dependencies, as shown below:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.1.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

What are the uses of the two different versions? Do you always use them together? Start documentation this spring to tell me whether the program can be used for production:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
</dependencies>

But if so, why isn't there a network like this:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web-actuator</artifactId>
    </dependency>
</dependencies>

Solution

Spring boots have many different "starters" Each of them tells Maven the dependencies needed to introduce that particular function So spring boot starter web introduces everything MVC needs and automatically configures it with reasonable defaults The real trick of spring bootstrapping is that it automatically configures it to use the entire @ conditionalonclass or something like annotations that look at dependencies on the classpath and provide configuration for those dependencies This means that when you have a spring start actuator starter, it will view your POM when it is automatically configured Other springs in XML start POMS, which will configure different endpoints for the actuator, so that you can see the metrics provided by various actuators for the specific module

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>