Skip to content

spring boot

hj yan edited this page Jul 29, 2018 · 4 revisions

启动spring boot

You can use Spring Boot to create Java applications that can be started by using java -jar or more traditional war deployments. We also provide a command line tool that runs “spring scripts”.

使用maven集成spring-boot

  1. inherit from the spring-boot-starter-parent project to obtain sensible defaults 包括:
  • Java 1.8 as the default compiler level.
  • UTF-8 source encoding.
  • A Dependency Management section, inherited from the spring-boot-dependencies pom, that manages the versions of common dependencies. This dependency management lets you omit tags for those dependencies when used in your own pom.(参照<dependcyMangement>的用法)
  • Sensible resource filtering.
  • Sensible plugin configuration (exec plugin, Git commit ID, and shade).
  • Sensible resource filtering for application.properties and application.yml including profile-specific files (for example, application-dev.properties and application-dev.yml)(spring的placeholder ${..} maven的@..@ 可以覆盖parent的properties e.g. 覆盖spring data release train
  1. 中导入spring-boot-dependencies中的部分.如果需要覆盖,将需要覆盖的依赖定义在spring-boot-dependencies之前.
<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.0.3.RELEASE</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

Clone this wiki locally