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

1.创建一个module

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

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

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

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

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

 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

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

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类,可以看到项目启动成功。

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

 

 

参考文献:

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

 

上一篇:通过Nginx反向代理解决Jeecg-boot前端跨域访问的问题。


下一篇:Springcloud学习笔记24--JeecgBoot 单体升级微服务启动