修复bug
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@ public class YouBianCodeUtil {
|
|||||||
*/
|
*/
|
||||||
public static synchronized String getNextYouBianCode(String code) {
|
public static synchronized String getNextYouBianCode(String code) {
|
||||||
String newcode = "";
|
String newcode = "";
|
||||||
if (code == null || code =="") {
|
if (oConvertUtils.isEmpty(code)) {
|
||||||
String zimu = "A";
|
String zimu = "A";
|
||||||
String num = getStrNum(1);
|
String num = getStrNum(1);
|
||||||
newcode = zimu + num;
|
newcode = zimu + num;
|
||||||
|
|||||||
+7
-3
@@ -1,14 +1,18 @@
|
|||||||
package com.jero.config;
|
package com.jero.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository;
|
import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.web.cors.CorsConfiguration;
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
@@ -72,9 +76,9 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加Long转json精度丢失的配置
|
* 添加Long转json精度丢失的配置
|
||||||
* @Return: void
|
* @Return: void
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
|
MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ public interface BaseCommonMapper {
|
|||||||
* 保存日志
|
* 保存日志
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@InterceptorIgnore
|
@InterceptorIgnore(illegalSql = "true", tenantLine = "true")
|
||||||
void saveLog(@Param("dto")LogDTO dto);
|
void saveLog(@Param("dto")LogDTO dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
|||||||
public class OnlCgformButton implements Serializable {
|
public class OnlCgformButton implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId(
|
@TableId(
|
||||||
type = IdType.UUID
|
type = IdType.ASSIGN_UUID
|
||||||
)
|
)
|
||||||
private String id;
|
private String id;
|
||||||
private String cgformHeadId;
|
private String cgformHeadId;
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
|||||||
public class OnlCgformEnhanceJava implements Serializable {
|
public class OnlCgformEnhanceJava implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId(
|
@TableId(
|
||||||
type = IdType.UUID
|
type = IdType.ASSIGN_UUID
|
||||||
)
|
)
|
||||||
private String id;
|
private String id;
|
||||||
private String cgformHeadId;
|
private String cgformHeadId;
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
|||||||
public class OnlCgformEnhanceJs implements Serializable {
|
public class OnlCgformEnhanceJs implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId(
|
@TableId(
|
||||||
type = IdType.UUID
|
type = IdType.ASSIGN_UUID
|
||||||
)
|
)
|
||||||
private String id;
|
private String id;
|
||||||
private String cgformHeadId;
|
private String cgformHeadId;
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import java.io.Serializable;
|
|||||||
public class OnlCgformEnhanceSql implements Serializable {
|
public class OnlCgformEnhanceSql implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId(
|
@TableId(
|
||||||
type = IdType.UUID
|
type = IdType.ASSIGN_UUID
|
||||||
)
|
)
|
||||||
private String id;
|
private String id;
|
||||||
private String cgformHeadId;
|
private String cgformHeadId;
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
public class OnlCgformField implements Serializable {
|
public class OnlCgformField implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId(
|
@TableId(
|
||||||
type = IdType.UUID
|
type = IdType.ASSIGN_UUID
|
||||||
)
|
)
|
||||||
private String id;
|
private String id;
|
||||||
private String cgformHeadId;
|
private String cgformHeadId;
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
public class OnlCgformHead implements Serializable {
|
public class OnlCgformHead implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId(
|
@TableId(
|
||||||
type = IdType.UUID
|
type = IdType.ASSIGN_UUID
|
||||||
)
|
)
|
||||||
private String id;
|
private String id;
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
public class OnlCgformIndex implements Serializable {
|
public class OnlCgformIndex implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@TableId(
|
@TableId(
|
||||||
type = IdType.UUID
|
type = IdType.ASSIGN_UUID
|
||||||
)
|
)
|
||||||
private String id;
|
private String id;
|
||||||
private String cgformHeadId;
|
private String cgformHeadId;
|
||||||
|
|||||||
@@ -29,11 +29,7 @@
|
|||||||
<!--加载hutool-->
|
<!--加载hutool-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-core</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.hutool</groupId>
|
|
||||||
<artifactId>hutool-crypto</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--加载beanutils-->
|
<!--加载beanutils-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ public class SysGatewayRouteServiceImpl extends ServiceImpl<SysGatewayRouteMappe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addRoute2Redis(String key) {
|
public void addRoute2Redis(String key) {
|
||||||
List<SysGatewayRoute> ls = this.list(new LambdaQueryWrapper<SysGatewayRoute>().eq(SysGatewayRoute::getStatus, 1));
|
List<SysGatewayRoute> ls = this.list(new LambdaQueryWrapper<SysGatewayRoute>());
|
||||||
redisTemplate.opsForValue().set(key, JSON.toJSONString(ls));
|
redisTemplate.opsForValue().set(key, JSON.toJSONString(ls));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,9 +77,6 @@ spring:
|
|||||||
#是否支持重试
|
#是否支持重试
|
||||||
retry:
|
retry:
|
||||||
enabled: true
|
enabled: true
|
||||||
#minidao
|
|
||||||
minidao :
|
|
||||||
base-package: com.jero.modules.jmreport.*
|
|
||||||
#jero专用配置
|
#jero专用配置
|
||||||
jero :
|
jero :
|
||||||
# 本地:local\Minio:minio\阿里云:alioss
|
# 本地:local\Minio:minio\阿里云:alioss
|
||||||
|
|||||||
+3
-1
@@ -3,6 +3,7 @@ package com.jero.handler;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cloud.gateway.route.RouteLocator;
|
import org.springframework.cloud.gateway.route.RouteLocator;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import springfox.documentation.swagger.web.SwaggerResource;
|
import springfox.documentation.swagger.web.SwaggerResource;
|
||||||
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
|
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
|
||||||
@@ -13,6 +14,7 @@ import java.util.*;
|
|||||||
* 聚合各个服务的swagger接口
|
* 聚合各个服务的swagger接口
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@Primary
|
||||||
public class MySwaggerResourceProvider implements SwaggerResourcesProvider {
|
public class MySwaggerResourceProvider implements SwaggerResourcesProvider {
|
||||||
/**
|
/**
|
||||||
* swagger2默认的url后缀
|
* swagger2默认的url后缀
|
||||||
@@ -44,7 +46,7 @@ public class MySwaggerResourceProvider implements SwaggerResourcesProvider {
|
|||||||
.filter(route -> !self.equals(route.getUri().getHost()))
|
.filter(route -> !self.equals(route.getUri().getHost()))
|
||||||
.subscribe(route -> routeHosts.add(route.getUri().getHost()));
|
.subscribe(route -> routeHosts.add(route.getUri().getHost()));
|
||||||
|
|
||||||
// 记录已经添加过的server,存在同一个应用注册了多个服务在eureka上
|
// 记录已经添加过的server,存在同一个应用注册了多个服务在nacos上
|
||||||
Set<String> dealed = new HashSet<>();
|
Set<String> dealed = new HashSet<>();
|
||||||
routeHosts.forEach(instance -> {
|
routeHosts.forEach(instance -> {
|
||||||
// 拼接url
|
// 拼接url
|
||||||
|
|||||||
+12
-7
@@ -128,7 +128,7 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private void loadRoutesByRedis() {
|
private void loadRoutesByRedis() {
|
||||||
List<RouteDefinition> routes = Lists.newArrayList();
|
List<MyRouteDefinition> routes = Lists.newArrayList();
|
||||||
configService = createConfigService();
|
configService = createConfigService();
|
||||||
if (configService == null) {
|
if (configService == null) {
|
||||||
log.warn("initConfigService fail");
|
log.warn("initConfigService fail");
|
||||||
@@ -143,9 +143,14 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (RouteDefinition definition : routes) {
|
for (MyRouteDefinition definition : routes) {
|
||||||
log.info("update route : {}", definition.toString());
|
log.info("update route : {}", definition.toString());
|
||||||
dynamicRouteService.add(definition);
|
Integer status=definition.getStatus();
|
||||||
|
if(status.equals(0)){
|
||||||
|
dynamicRouteService.delete(definition.getId());
|
||||||
|
}else{
|
||||||
|
dynamicRouteService.add(definition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.publisher.publishEvent(new RefreshRoutesEvent(this));
|
this.publisher.publishEvent(new RefreshRoutesEvent(this));
|
||||||
}
|
}
|
||||||
@@ -160,13 +165,13 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
|||||||
* @param array
|
* @param array
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
public static List<MyRouteDefinition> getRoutesByJson(JSONArray array) throws URISyntaxException {
|
||||||
public static List<RouteDefinition> getRoutesByJson(JSONArray array) throws URISyntaxException {
|
List<MyRouteDefinition> ls = new ArrayList<>();
|
||||||
List<RouteDefinition> ls = new ArrayList<>();
|
|
||||||
for (int i = 0; i < array.size(); i++) {
|
for (int i = 0; i < array.size(); i++) {
|
||||||
JSONObject obj = array.getJSONObject(i);
|
JSONObject obj = array.getJSONObject(i);
|
||||||
RouteDefinition route = new RouteDefinition();
|
MyRouteDefinition route = new MyRouteDefinition();
|
||||||
route.setId(obj.getString("routerId"));
|
route.setId(obj.getString("routerId"));
|
||||||
|
route.setStatus(obj.getInteger("status"));
|
||||||
Object uri = obj.get("uri");
|
Object uri = obj.get("uri");
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
route.setUri(new URI("lb://" + obj.getString("name")));
|
route.setUri(new URI("lb://" + obj.getString("name")));
|
||||||
|
|||||||
+7
-8
@@ -47,14 +47,13 @@ public class DynamicRouteService implements ApplicationEventPublisherAware {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public synchronized Mono<ResponseEntity<Object>> delete(String id) {
|
public synchronized void delete(String id) {
|
||||||
return this.repository.delete(Mono.just(id)).then(Mono.defer(() -> {
|
try {
|
||||||
return Mono.just(ResponseEntity.ok().build());
|
repository.delete(Mono.just(id)).subscribe();
|
||||||
})).onErrorResume((t) -> {
|
this.publisher.publishEvent(new RefreshRoutesEvent(this));
|
||||||
return t instanceof NotFoundException;
|
}catch (Exception e){
|
||||||
}, (t) -> {
|
e.printStackTrace();
|
||||||
return Mono.just(ResponseEntity.notFound().build());
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package com.jero.loader;
|
||||||
|
|
||||||
|
import org.springframework.cloud.gateway.route.RouteDefinition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义RouteDefinition
|
||||||
|
* @author zyf
|
||||||
|
*/
|
||||||
|
public class MyRouteDefinition extends RouteDefinition {
|
||||||
|
/**
|
||||||
|
* 路由状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,23 +16,23 @@ spring:
|
|||||||
allowedMethods: "*"
|
allowedMethods: "*"
|
||||||
allowedHeaders: "*"
|
allowedHeaders: "*"
|
||||||
#如果启用nacos或者数据库配置请删除一下配置
|
#如果启用nacos或者数据库配置请删除一下配置
|
||||||
routes:
|
# routes:
|
||||||
- id: jero-demo
|
# - id: jero-demo
|
||||||
uri: lb://jero-demo
|
# uri: lb://jero-demo
|
||||||
predicates:
|
# predicates:
|
||||||
- Path=/mock/**,/test/**,/bigscreen/template1/**,/bigscreen/template2/**
|
# - Path=/mock/**,/test/**,/bigscreen/template1/**,/bigscreen/template2/**
|
||||||
- id: jero-system
|
# - id: jero-system
|
||||||
uri: lb://jero-system
|
# uri: lb://jero-system
|
||||||
predicates:
|
# predicates:
|
||||||
- Path=/sys/**,/eoa/**,/v1/**,/joa/**,/online/**,/bigscreen/**,/jmreport/**,/desform/**,/act/**,/plug-in/**,/generic/**
|
# - Path=/sys/**,/eoa/**,/v1/**,/joa/**,/online/**,/bigscreen/**,/jmreport/**,/desform/**,/act/**,/plug-in/**,/generic/**
|
||||||
- id: jero-system-websocket
|
# - id: jero-system-websocket
|
||||||
uri: lb:ws://jero-system
|
# uri: lb:ws://jero-system
|
||||||
predicates:
|
# predicates:
|
||||||
- Path=/websocket/**,/eoaSocket/**,/newsWebsocket/**
|
# - Path=/websocket/**,/eoaSocket/**,/newsWebsocket/**
|
||||||
- id: jero-demo-websocket
|
# - id: jero-demo-websocket
|
||||||
uri: lb:ws://jero-demo
|
# uri: lb:ws://jero-demo
|
||||||
predicates:
|
# predicates:
|
||||||
- Path=/vxeSocket/**
|
# - Path=/vxeSocket/**
|
||||||
# 全局熔断降级配置
|
# 全局熔断降级配置
|
||||||
default-filters:
|
default-filters:
|
||||||
- name: Hystrix
|
- name: Hystrix
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
FROM anapsix/alpine-java:8_server-jre_unlimited
|
||||||
|
|
||||||
|
MAINTAINER jeroos@163.com
|
||||||
|
|
||||||
|
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||||
|
|
||||||
|
RUN mkdir -p /jeecg-cloud-nacos
|
||||||
|
|
||||||
|
WORKDIR /jeecg-cloud-nacos
|
||||||
|
|
||||||
|
EXPOSE 8848
|
||||||
|
|
||||||
|
ADD ./target/jeecg-cloud-nacos-2.4.6.jar ./
|
||||||
|
|
||||||
|
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jero-cloud-nacos-2.4.6.jar
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<artifactId>jero-cloud-module</artifactId>
|
||||||
|
<groupId>com.jero.boot</groupId>
|
||||||
|
<version>2.4.6</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>jero-cloud-nacos</artifactId>
|
||||||
|
<name>jero-cloud-nacos</name>
|
||||||
|
<description>nacos启动模块</description>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>aliyun</id>
|
||||||
|
<name>aliyun Repository</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jeecg</id>
|
||||||
|
<name>jeecg Repository</name>
|
||||||
|
<url>https://maven.jeecg.org/nexus/content/repositories/jeecg</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-jasper</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.nacos</groupId>
|
||||||
|
<artifactId>nacos-naming</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.nacos</groupId>
|
||||||
|
<artifactId>nacos-istio</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.nacos</groupId>
|
||||||
|
<artifactId>nacos-config</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.nacos</groupId>
|
||||||
|
<artifactId>nacos-console</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package com.alibaba.nacos;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nacos 启动类
|
||||||
|
* 引用的nacos console 源码运行,简化开发
|
||||||
|
* 生产建议从官网下载最新版配置运行
|
||||||
|
* @author zyf
|
||||||
|
*/
|
||||||
|
@SpringBootApplication(scanBasePackages = "com.alibaba.nacos")
|
||||||
|
@ServletComponentScan
|
||||||
|
@EnableScheduling
|
||||||
|
public class JeecgNacosApplication {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否单机模式启动
|
||||||
|
*/
|
||||||
|
private static String standalone = "true";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启鉴权
|
||||||
|
*/
|
||||||
|
private static String enabled = "false";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.setProperty("nacos.standalone", standalone);
|
||||||
|
System.setProperty("nacos.core.auth.enabled", enabled);
|
||||||
|
System.setProperty("server.tomcat.basedir","logs");
|
||||||
|
//自定义启动端口号
|
||||||
|
System.setProperty("server.port","8848");
|
||||||
|
SpringApplication.run(JeecgNacosApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
server:
|
||||||
|
servlet:
|
||||||
|
contextPath: /nacos
|
||||||
|
tomcat:
|
||||||
|
accesslog:
|
||||||
|
enabled: true
|
||||||
|
pattern: '%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i'
|
||||||
|
basedir: ''
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
platform: mysql
|
||||||
|
db:
|
||||||
|
num: 1
|
||||||
|
password:
|
||||||
|
'0': ${MYSQL-PWD:root}
|
||||||
|
url:
|
||||||
|
'0': jdbc:mysql://${MYSQL-HOST:jero-boot-mysql}:${MYSQL-PORT:3306}/${MYSQL-DB:nacos}?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||||
|
user:
|
||||||
|
'0': ${MYSQL-USER:root}
|
||||||
|
management:
|
||||||
|
metrics:
|
||||||
|
export:
|
||||||
|
elastic:
|
||||||
|
enabled: false
|
||||||
|
influx:
|
||||||
|
enabled: false
|
||||||
|
nacos:
|
||||||
|
core:
|
||||||
|
auth:
|
||||||
|
caching:
|
||||||
|
enabled: true
|
||||||
|
default:
|
||||||
|
token:
|
||||||
|
expire:
|
||||||
|
seconds: 18000
|
||||||
|
secret:
|
||||||
|
key: SecretKey012345678901234567890123456789012345678901234567890123456789
|
||||||
|
enabled: false
|
||||||
|
system:
|
||||||
|
type: nacos
|
||||||
|
istio:
|
||||||
|
mcp:
|
||||||
|
server:
|
||||||
|
enabled: false
|
||||||
|
naming:
|
||||||
|
empty-service:
|
||||||
|
auto-clean: true
|
||||||
|
clean:
|
||||||
|
initial-delay-ms: 50000
|
||||||
|
period-time-ms: 30000
|
||||||
|
security:
|
||||||
|
ignore:
|
||||||
|
urls: /,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||||
|
standalone: true
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package com.jero.modules.cloud.lock;
|
package com.jero.modules.cloud.lock;
|
||||||
|
|
||||||
|
import com.jero.boot.starter.lock.annotation.JLock;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.jero.boot.starter.lock.annotation.DistributedLock;
|
|
||||||
import com.jero.boot.starter.lock.client.RedissonLockClient;
|
import com.jero.boot.starter.lock.client.RedissonLockClient;
|
||||||
import com.jero.boot.starter.rabbitmq.client.RabbitMqClient;
|
import com.jero.boot.starter.rabbitmq.client.RabbitMqClient;
|
||||||
import com.jero.common.base.BaseMap;
|
import com.jero.common.base.BaseMap;
|
||||||
@@ -28,7 +28,7 @@ public class DemoLockTest {
|
|||||||
* 测试分布式锁【注解方式】
|
* 测试分布式锁【注解方式】
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0/5 * * * * ?")
|
@Scheduled(cron = "0/5 * * * * ?")
|
||||||
@DistributedLock(lockKey = CloudConstant.REDISSON_DEMO_LOCK_KEY1)
|
@JLock(lockKey = CloudConstant.REDISSON_DEMO_LOCK_KEY1)
|
||||||
public void execute() throws InterruptedException {
|
public void execute() throws InterruptedException {
|
||||||
log.info("执行execute任务开始,休眠三秒");
|
log.info("执行execute任务开始,休眠三秒");
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
<module>jero-cloud-monitor</module>
|
<module>jero-cloud-monitor</module>
|
||||||
<module>jero-cloud-xxljob</module>
|
<module>jero-cloud-xxljob</module>
|
||||||
<module>jero-cloud-sentinel</module>
|
<module>jero-cloud-sentinel</module>
|
||||||
|
<module>jero-cloud-nacos</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -238,17 +238,6 @@
|
|||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>${hutool.version}</version>
|
<version>${hutool.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>cn.hutool</groupId>
|
|
||||||
<artifactId>hutool-core</artifactId>
|
|
||||||
<version>${hutool.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.hutool</groupId>
|
|
||||||
<artifactId>hutool-crypto</artifactId>
|
|
||||||
<version>${hutool.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- commons-beanutils -->
|
<!-- commons-beanutils -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-beanutils</groupId>
|
<groupId>commons-beanutils</groupId>
|
||||||
|
|||||||
Reference in New Issue
Block a user