How does SpringBoot manage the relationship between encapsulated java packages

First of all, SpringBoot can directly write annotations and dependencies. Basically, there is no need to write xml, which is very convenient. Here I only wrote two core packages.

 

Why choose the jar type?

       SpringBoot is basically an application, as long as the java command program is used to run it, so there is no need to select the war type

 

core dependencies

<!—Introduce SpringBoot parent class dependency --> 
< dependencyManagement > //As long as this parent class dependency is introduced, he will depend on some commonly used dependency packages
    < dependencies >
        < dependency >
            < groupId >org.springframework.boot</ groupId >
            < artifactId >spring-boot-dependencies</ artifactId >
            < version >1.4.3.RELEASE</ version >
            < type >pom</ type >
            < scope >import</ scope >
        </dependency>
    </dependencies>
</dependencyManagement>

<!-SpringBoot-web component--> //SpringBoot is an MVC by default, and the introduction of this dependency SpringMVC+spring+mybatis will give you all the integration, and there is no need to worry about version conflicts, no need to write versions

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

 

Why does a java package integrate SpringMVC+spring+mybatis ? (SpringBoot encapsulates the java dependency principle )

       In fact, just like the dependencies of maven, all the jar packages of maven are in the parent, and then packaged in the parent. He is also, they are all packaged for you, so the principle of SpringBoot encapsulating java dependencies is to manage jar packages according to maven's inheritance dependencies.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324808865&siteId=291194637