赞
踩
当前系统分为system、demo 等模块,现有需求把每个模块单独启动作为微服务应用,故而推出新版boot【20200812beta】,支持快速切换成cloud,本项目cloud技术栈为:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-LG6QwOO7-1597802895637)(images/screenshot_1597402774325.png)]
<!-- nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
spring:
profiles:
active: dev
application:
name: jeecg-system
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4SrlFeWJ-1597802895641)(images/screenshot_1597570291088.png)]
@EnableDiscoveryClient
以demo为例:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rMOiilMF-1597802895643)(images/screenshot_1597403237245.png)]
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-cloud-api</artifactId>
</dependency>
spring:
profiles:
active: dev
application:
name: jeecg-demo
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-QfE4LYpC-1597802895646)(images/screenshot_1597403472075.png)]
package org.jeecg; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; import java.net.UnknownHostException; @SpringBootApplication @EnableDiscoveryClient @EnableFeignClients public class JeecgDemoApplication { public static void main(String[] args) throws UnknownHostException { SpringApplication.run(JeecgDemoApplication.class, args); } }
上述步骤完成 即可启动nacos 运行每个模块的启动类 测试微服务。
localhost:8848/nacos
账号密码 都是nacos,查看服务列表#备注:前后端交互需要修改一些配置、
1.每个服务yml配置中有个属性 context-path: /jeecg-boot
,服务化后需要修改成/
,或者直接删除该配置
2.前端项目找到文件public/index.html
修改地址:window._CONFIG['domianURL'] = 'http://127.0.0.1:9999
,其中端口号 9999
和gateway的端口保持一致
3. 跨域设置,此设置可以忽略,文档留作记录
# 跨域问题注释掉这俩类的跨域设置
org/jeecg/config/shiro/filters/JwtFilter.java:65
org/jeecg/config/WebMvcConfiguration.java:49
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。