springboot learning: knowledge of the two documents

1, spring-boot-starter- parent configuration
[default compiler for the Java8]
[UTF-8 encoding]
[dependency management, inherited from the spring-boot-dependencies, commonly used to manage dependencies version, so you use when ignore version of the problem]
[repackage Executive]
[resources] filter
[plug-in configuration]
[application.properties and application.yml load]
Note: because application.properties Spring and application.yml accepted format $ {...} placeholder, Maven filter is changed to @ ... @ placeholder (you can cover Maven used to modify the configuration file resource.delimiter).

2, configure their dependence
if spring-boot-starter-parent configuration does not meet your needs, you can declare configured to meet your needs dependent. Pom.xml file in your project, in accordance with the following format:

<properties>
	<spring-data-releasetrain.version>Fowler-SR2</spring-data-releasetrain.version>
</properties>

The use of Fowler-SR2 version of Spring Data.

3, using scope = import
if you do not want to inherit spring-boot-starter-parent, but want to retain the benefits dependent relationship management (non-plug-in management), you can use to set the scope = import. as follows:

<dependencyManagement>
	<dependencies>
		<dependency>
			<!-- Import dependency management from Spring Boot -->
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-dependencies</artifactId>
			<version>2.1.12.RELEASE</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

The above setting is not allowed to set a single property dependent property.

[Analysis] using the parent inheritance spring-boot-starter-parent way, can only achieve single inheritance pom file. But the actual development process, you may need to implement multiple inheritance, need your pom files inherit parent company's standard configuration.

scope = import is the way to achieve multiple inheritance.

The above examples, pom jar file inherits the package depends pom spring-boot-dependencies of the 2.1.12.RELEASE dependencyManagement configuration.

The following examples are acquired dependencyManagement arranged spring-boot-dependencies 2.1.12.RELEASE and spring-data-releasetrain Fowler-SR2 achieve a multiple inheritance.

<dependencyManagement>
	<dependencies>
		<!-- Override Spring Data release train provided by Spring Boot -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-releasetrain</artifactId>
			<version>Fowler-SR2</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-dependencies</artifactId>
			<version>2.1.12.RELEASE</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>
Published 13 original articles · won praise 0 · Views 211

Guess you like

Origin blog.csdn.net/weixin_43859070/article/details/104058402
Recommended