SpringCloud微服务实战——搭建企业级开发框架(四)(集成SpringCloud+SpringBoot)

1、在GitEgg工程的根目录,最上级父pom.xml文件中引入需要依赖的库及Maven插件,设置编码方式:

4.0.0com.gitegg.cloud GitEgg-Cloud gitegg-cloudpom 1.0-SNAPSHOT gitegg-common gitegg-oauth gitegg-gateway gitegg-plugin gitegg-service gitegg-service-api 1.83.8.1UTF-8UTF-8UTF-81.0-SNAPSHOT2.3.3.RELEASEHoxton.SR8 org.projectlombok lombok org.springframework.boot spring-boot-dependencies ${spring.boot.version} pom import org.springframework.cloud spring-cloud-dependencies ${spring.cloud.version} pom import ${project.name} src/main/resources src/main/java **/*.xml org.springframework.boot spring-boot-maven-plugin ${spring.boot.version} true ${project.build.finalName} repackage org.springframework.boot spring-boot-maven-plugin maven-compiler-plugin ${maven.plugin.version} ${java.version} ${java.version} UTF-8 -parameters

2、修改gitegg-service的pom.xml文件,引入需要的库:
GitEgg-Cloud com.gitegg.cloud 1.0-SNAPSHOT 4.0.0gitegg-servicepom gitegg-service-base gitegg-service-bigdata gitegg-service-system org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-actuator

3、在gitegg-service-system工程下新建GitEggSystemApplication主启动类:
package com.gitegg.service.system; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * gitegg-system 启动类 */ @SpringBootApplication public class GitEggSystemApplication {public static void main(String[] args) { SpringApplication.run(GitEggSystemApplication.class,args); }}

4、在gitegg-service-system工程的resources目录下新建application.yml文件:
server: port: 8001 spring: application: name: gitegg-service-system

5、在GitEggSystemApplication类上右键,Run 'GitEggSystemApplicat...' ,运行项目,可以看到最基础的SpringBoot项目启动成功:
SpringCloud微服务实战——搭建企业级开发框架(四)(集成SpringCloud+SpringBoot)
文章图片

【SpringCloud微服务实战——搭建企业级开发框架(四)(集成SpringCloud+SpringBoot)】本文源码在https://gitee.com/wmz1930/GitEgg 的chapter-04分支。

    推荐阅读