Springcloud学习笔记26--JeecgBoot 新建一个微服务模块

1.创建一个module

 

 

 创建完成后,项目结构为:

 2.创建文件目录、启动类

(1)在pom文件添加依赖和打包插件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>jeecg-cloud-module</artifactId>
        <groupId>org.jeecgframework.boot</groupId>
        <version>2.4.6</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.jeecgframework.boot</groupId>
    <artifactId>jeecg-cloud-test</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.jeecgframework.boot</groupId>
            <artifactId>jeecg-boot-base-core</artifactId>
        </dependency>
        <!--引入微服务启动依赖 starter-->
        <dependency>
            <groupId>org.jeecgframework.boot</groupId>
            <artifactId>jeecg-boot-starter-cloud</artifactId>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

(2)添加配置文件application.yml

server:
  port: 7004
spring:
  application:
    name: jeecg-cloud-test

(3)添加启动类

package org.jeecg;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;

@SpringBootApplication(scanBasePackages = "org.jeecg")
@EnableFeignClients(basePackages = "org.jeecg")
public class JeecgCloudTestApplication {

    public static void main(String[] args) {
        SpringApplication.run(JeecgCloudTestApplication.class, args);
    }
}

启动JeecgCloudTestApplication类,可以看到项目启动成功。

 

 

参考文献:

jeecg-boot:注解扫描范围问题    https://blog.csdn.net/gwcgwcjava/article/details/95967349

 

相关文章

本篇文章为大家展示了如何解决Spring Cloud 服务冲突问题,内...
本篇内容主要讲解“spring cloud服务的注册与发现怎么实现”...
本篇内容介绍了“Dubbo怎么实现Spring Cloud服务治理 ”的有...
本篇内容主要讲解“SpringCloud相关面试题有哪些”,感兴趣的...
如何分析Spring Cloud Ribbon、Spring Cloud Feign以及断路器...
这篇文章主要讲解了“springcloud微服务的组成部分有哪些”,...