升级某个模块为微服务模块, 这里以demo为例
1.添加微服务启动依赖
修改pom,引入jeecg-boot-starter-cloud依赖
<!-- 引入jeecg-boot-starter-cloud依赖 --> <dependency> <groupId>org.jeecgframework.boot</groupId> <artifactId>jeecg-boot-starter-cloud</artifactId> </dependency>
加入打包插件
<plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins>
2.添加配置文件application.yml(可以忽略)
如果没有则新建,内容如下:
server:
port: 7002
spring:
application:
name: jeecg-demo
3.在org.jeecg包下新建启动类(如果没有)
package org.jeecg; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication @EnableFeignClients public class JeecgDemoApplication { public static void main(String[] args) { SpringApplication.run(JeecgDemoApplication.class, args); } }
上述步骤完成 即可启动 demo 微服务模块,前提得把nacos配置成功。
注意:需要在jeecg-cloud-gateway添加路由