微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐