集成 springboot 有两种方式。

1 直接 父项目指向  springboot 

  

<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.3.RELEASE</version>
	</parent>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.

  这种用起来很方便 ,默认打出的jar 也是完整的。

2 使用  spring-boot-dependencie 

<!-- springcloud -->
	<dependencyManagement>
		<dependencies>
			
			<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>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.

  这种默认打出的jar包是不完整的。 不能直接运行。

加入下面的配置就可以了

<build>
	    <plugins>
	        <plugin>
	            <groupId>org.springframework.boot</groupId>
	            <artifactId>spring-boot-maven-plugin</artifactId>
	            <configuration>
	                <mainClass>com.sbl.pay.subaccount.SubaccountServerRunner</mainClass>
	            </configuration>
	            <executions>
	                <execution>
	                    <goals>
	                        <goal>repackage</goal>
	                    </goals>
	                </execution>
	            </executions>
	        </plugin>
	    </plugins>
	</build>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.

  

第二种麻烦一点,但是我们可以使用自己的父类。