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

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



    4.0.0

    com.gitegg.cloud
    GitEgg-Cloud
    gitegg-cloud
    pom
    1.0-SNAPSHOT

    
        gitegg-common
        gitegg-oauth
        gitegg-gateway
        gitegg-plugin
        gitegg-service
        gitegg-service-api
    

    
        
        1.8
        
        3.8.1
        
        UTF-8
        
        UTF-8
        
        UTF-8

        
        1.0-SNAPSHOT
        
        2.3.3.RELEASE
        
        Hoxton.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.0

    gitegg-service
    pom
    
        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_第1张图片
image.png

本章源码在https://gitee.com/wmz1930/gitegg-cloud 的chapter-04分支。

你可能感兴趣的:(SpringCloud微服务实战——搭建企业级开发框架(四):集成SpringCloud+SpringBoot)