mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
JeecgBoot低代码平台 3.0版本发布—新里程牌开始,迎接VUE3版本到来!!
This commit is contained in:
@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-gateway
|
||||
|
||||
EXPOSE 9999
|
||||
|
||||
ADD ./target/jeecg-cloud-gateway-2.4.6.jar ./
|
||||
ADD ./target/jeecg-cloud-gateway-3.0.jar ./
|
||||
|
||||
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-gateway-2.4.6.jar
|
||||
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-gateway-3.0.jar
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.6</version>
|
||||
<version>3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -77,11 +77,6 @@
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger API文档 -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-ui</artifactId>
|
||||
<version>${knife4j-spring-ui.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
|
||||
@ -34,6 +34,6 @@ public class JeecgGatewayApplication implements CommandLineRunner {
|
||||
*/
|
||||
@Override
|
||||
public void run(String... strings) {
|
||||
dynamicRouteLoader.refresh();
|
||||
dynamicRouteLoader.refresh(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ public class LoderRouderHandler implements JeecgRedisListerer {
|
||||
|
||||
@Override
|
||||
public void onMessage(BaseMap message) {
|
||||
dynamicRouteLoader.refresh();
|
||||
dynamicRouteLoader.refresh(message);
|
||||
}
|
||||
|
||||
}
|
||||
@ -11,6 +11,8 @@ import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.common.constant.CacheConstant;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.config.GatewayRoutersConfiguration;
|
||||
@ -66,6 +68,9 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
init(null);
|
||||
}
|
||||
public void init(BaseMap baseMap) {
|
||||
String dataType = GatewayRoutersConfiguration.DATA_TYPE;
|
||||
log.info("初始化路由,dataType:"+ dataType);
|
||||
if (RouterDataType.nacos.toString().endsWith(dataType)) {
|
||||
@ -73,20 +78,18 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
||||
}
|
||||
//从数据库加载路由
|
||||
if (RouterDataType.database.toString().endsWith(dataType)) {
|
||||
loadRoutesByRedis();
|
||||
loadRoutesByRedis(baseMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新路由
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Mono<Void> refresh() {
|
||||
public Mono<Void> refresh(BaseMap baseMap) {
|
||||
String dataType = GatewayRoutersConfiguration.DATA_TYPE;
|
||||
if (!RouterDataType.yml.toString().endsWith(dataType)) {
|
||||
this.init();
|
||||
this.init(baseMap);
|
||||
}
|
||||
return Mono.empty();
|
||||
}
|
||||
@ -127,7 +130,7 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private void loadRoutesByRedis() {
|
||||
private void loadRoutesByRedis(BaseMap baseMap) {
|
||||
List<MyRouteDefinition> routes = Lists.newArrayList();
|
||||
configService = createConfigService();
|
||||
if (configService == null) {
|
||||
@ -152,6 +155,12 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
||||
dynamicRouteService.add(definition);
|
||||
}
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(baseMap)){
|
||||
String routerId=baseMap.get("routerId");
|
||||
if(ObjectUtils.isNotEmpty(routerId)) {
|
||||
dynamicRouteService.delete(routerId);
|
||||
}
|
||||
}
|
||||
this.publisher.publishEvent(new RefreshRoutesEvent(this));
|
||||
}
|
||||
|
||||
@ -277,8 +286,8 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
log.info("进行网关更新:\n\r{}", configInfo);
|
||||
List<RouteDefinition> definitionList = JSON.parseArray(configInfo, RouteDefinition.class);
|
||||
for (RouteDefinition definition : definitionList) {
|
||||
List<MyRouteDefinition> definitionList = JSON.parseArray(configInfo, MyRouteDefinition.class);
|
||||
for (MyRouteDefinition definition : definitionList) {
|
||||
log.info("update route : {}", definition.toString());
|
||||
dynamicRouteService.update(definition);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class DynamicRouteService implements ApplicationEventPublisherAware {
|
||||
repository.delete(Mono.just(id)).subscribe();
|
||||
this.publisher.publishEvent(new RefreshRoutesEvent(this));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ public class DynamicRouteService implements ApplicationEventPublisherAware {
|
||||
public synchronized String update(RouteDefinition definition) {
|
||||
try {
|
||||
log.info("gateway update route {}", definition);
|
||||
delete(definition.getId());
|
||||
//delete(definition.getId());
|
||||
} catch (Exception e) {
|
||||
return "update fail,not find route routeId: " + definition.getId();
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.6</version>
|
||||
<version>3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-cloud-monitor</artifactId>
|
||||
|
||||
@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-nacos
|
||||
|
||||
EXPOSE 8848
|
||||
|
||||
ADD ./target/jeecg-cloud-nacos-2.4.6.jar ./
|
||||
ADD ./target/jeecg-cloud-nacos-3.0.jar ./
|
||||
|
||||
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-nacos-2.4.6.jar
|
||||
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-nacos-3.0.jar
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.6</version>
|
||||
<version>3.0</version>
|
||||
</parent>
|
||||
<artifactId>jeecg-cloud-nacos</artifactId>
|
||||
<name>jeecg-cloud-nacos</name>
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
访问地址
|
||||
http://localhost:8087
|
||||
|
||||
账号密码:sentinel/sentinel
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.6</version>
|
||||
<version>3.0</version>
|
||||
</parent>
|
||||
<artifactId>jeecg-cloud-sentinel</artifactId>
|
||||
<name>jeecg-cloud-sentinel</name>
|
||||
|
||||
@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-system
|
||||
|
||||
EXPOSE 7001
|
||||
|
||||
ADD ./target/jeecg-cloud-system-start-2.4.6.jar ./
|
||||
ADD ./target/jeecg-cloud-system-start-3.0.jar ./
|
||||
|
||||
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-system-start-2.4.6.jar
|
||||
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-system-start-3.0.jar
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.6</version>
|
||||
<version>3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-cloud-system-start</artifactId>
|
||||
|
||||
@ -10,7 +10,7 @@ WORKDIR /jeecg-cloud-xxljob
|
||||
|
||||
EXPOSE 9080
|
||||
|
||||
ADD ./target/jeecg-cloud-xxljob-2.4.6.jar ./
|
||||
ADD ./target/jeecg-cloud-xxljob-3.0.jar ./
|
||||
|
||||
CMD java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-xxljob-2.4.6.jar
|
||||
CMD java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-xxljob-3.0.jar
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.6</version>
|
||||
<version>3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>2.4.6</version>
|
||||
<version>3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user