diff --git a/pom.xml b/pom.xml
index 761a146..86c0a8b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,9 +9,9 @@
Demo project for Spring Boot
- com.lz.eb
- eb-starter-parent
- 3.0.0.RELEASE
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.5.4
@@ -19,24 +19,18 @@
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
+ 3.0.3
org.springframework.cloud
spring-cloud-starter-gateway
+ 3.0.3
org.springframework.cloud
spring-cloud-starter-loadbalancer
+ 3.0.3
-
org.springframework.boot
spring-boot-starter-data-redis
@@ -45,17 +39,29 @@
org.springframework.cloud
spring-cloud-starter-sleuth
+ 3.0.3
+
+
+
+
org.projectlombok
lombok
+
+
+
com.google.guava
guava
+ 18.0
+
+
+
com.google.code.gson
gson
@@ -64,6 +70,7 @@
com.alibaba
fastjson
+ 1.2.75
org.springframework.boot
@@ -75,26 +82,15 @@
jsr305
3.0.1
-
junit
junit
4.13
+
+
+
+
diff --git a/src/main/java/com/lz/eb/config/CoreAutoConfiguration.java b/src/main/java/com/lz/eb/config/CoreAutoConfiguration.java
deleted file mode 100644
index feeabc7..0000000
--- a/src/main/java/com/lz/eb/config/CoreAutoConfiguration.java
+++ /dev/null
@@ -1,14 +0,0 @@
-//package com.lz.eb.config;
-//
-//import org.springframework.cloud.netflix.ribbon.RibbonClients;
-//import org.springframework.context.annotation.Configuration;
-//
-///**
-// * @author xujin DefaultRibbonConfiguration 加载LWR规则
-// */
-//@Configuration
-//@RibbonClients(defaultConfiguration = DefaultRibbonConfiguration.class)
-//public class CoreAutoConfiguration {
-//
-//
-//}
diff --git a/src/main/java/com/lz/eb/config/DefaultRibbonConfiguration.java b/src/main/java/com/lz/eb/config/DefaultRibbonConfiguration.java
deleted file mode 100644
index 858bbbe..0000000
--- a/src/main/java/com/lz/eb/config/DefaultRibbonConfiguration.java
+++ /dev/null
@@ -1,40 +0,0 @@
-//package com.lz.eb.config;
-//
-//import com.netflix.client.config.IClientConfig;
-//import com.netflix.loadbalancer.IRule;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.cloud.netflix.ribbon.PropertiesFactory;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.util.StringUtils;
-//
-///**
-// *
-// *
-// */
-//public class DefaultRibbonConfiguration {
-// @Value("${ribbon.client.name:#{null}}")
-// private String name;
-//
-// @Autowired(required = false)
-// private IClientConfig config;
-//
-// @Autowired
-// private PropertiesFactory propertiesFactory;
-//
-// @Bean
-// public IRule ribbonRule() {
-// if (StringUtils.isEmpty(name)) {
-// return null;
-// }
-//
-// if (this.propertiesFactory.isSet(IRule.class, name)) {
-// return this.propertiesFactory.get(IRule.class, config, name);
-// }
-//
-// // LWR 默认配置
-// DynamicZoneAvoidanceRule rule = new DynamicZoneAvoidanceRule();
-// rule.initWithNiwsConfig(config);
-// return rule;
-// }
-//}
diff --git a/src/main/java/com/lz/eb/config/DynamicZoneAvoidanceRule.java b/src/main/java/com/lz/eb/config/DynamicZoneAvoidanceRule.java
deleted file mode 100644
index 2abc7d4..0000000
--- a/src/main/java/com/lz/eb/config/DynamicZoneAvoidanceRule.java
+++ /dev/null
@@ -1,53 +0,0 @@
-//package com.lz.eb.config;
-//
-//import com.google.common.base.Optional;
-//import com.google.common.collect.Lists;
-//import com.netflix.loadbalancer.Server;
-//import com.netflix.loadbalancer.ZoneAvoidanceRule;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.data.redis.core.RedisTemplate;
-//
-//import java.util.List;
-//import java.util.Set;
-//
-///**
-// * @author wutao
-// * @description 优化负载均衡
-// * @date 2020-11-17
-// */
-//@Slf4j
-//public class DynamicZoneAvoidanceRule extends ZoneAvoidanceRule {
-// private final static String DEPLOY_SERVER_IPS = "ips";
-//
-// @Autowired
-// RedisTemplate redisTemplate;
-// @Override
-// public Server choose(Object key) {
-// List ss = this.getLoadBalancer().getAllServers();
-// List serverList = this.getPredicate().getEligibleServers(ss, key);
-// List servers = Lists.newArrayList();
-// Set hosts = redisTemplate.opsForHash().keys(DEPLOY_SERVER_IPS);
-// if(hosts == null){
-// servers.addAll(serverList);
-// }else{
-// for (Server server : serverList) {
-// String hostPost = new StringBuffer(server.getHost()).append("_").append(server.getPort()).toString();
-// if(!hosts.contains(hostPost)){
-// servers.add(server);
-// }else {
-// Object obj = redisTemplate.opsForHash().get(DEPLOY_SERVER_IPS,hostPost);
-// if(obj == null || (Long)obj-System.currentTimeMillis()<0){
-// servers.add(server);
-// }
-// log.info("hostPort= {} 正在发布。。。", hostPost);
-// }
-// }
-// }
-// Optional server = getPredicate().chooseRoundRobinAfterFiltering(servers, key);
-// if (server.isPresent()) {
-// return server.get();
-// }
-// return null;
-// }
-//}
diff --git a/src/main/java/com/lz/eb/util/aes/AES.java b/src/main/java/com/lz/eb/util/aes/AES.java
index fe01f87..f3cf489 100644
--- a/src/main/java/com/lz/eb/util/aes/AES.java
+++ b/src/main/java/com/lz/eb/util/aes/AES.java
@@ -1,6 +1,5 @@
package com.lz.eb.util.aes;
-import sun.misc.BASE64Encoder;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
@@ -8,36 +7,27 @@ import java.io.UnsupportedEncodingException;
/**
- *
* @author renlei
- *
*/
public class AES {
public static final String CHAR_ENCODING = "UTF-8";
public static final String AES = "AES";
-// public static final String AES_ALGORITHM = "AES/ECB/PKCS5Padding";
+ // public static final String AES_ALGORITHM = "AES/ECB/PKCS5Padding";
public static final String AES_ALGORITHM = "AES";
/**
- * @Description: 加密方法
- * @param data
- * 需要加密的内容
- * @param key
- * 加密密码
+ * @param data 需要加密的内容
+ * @param key 加密密码
* @return byte[]
* @throws
+ * @Description: 加密方法
*/
public static String encrypt2hex(String data, String key) {
-
- byte [] ret = encrypt(data.getBytes(),key.getBytes());
+
+ byte[] ret = encrypt(data.getBytes(), key.getBytes());
return byte2hex(ret);
}
-
- public static String encrypt2base64(String data, String key) {
-
- byte [] ret = encrypt(data.getBytes(),key.getBytes());
- return new String(new BASE64Encoder().encode(ret));
- }
+
public static byte[] encrypt(byte[] data, byte[] key) {
if (key.length != 16) {
@@ -53,28 +43,27 @@ public class AES {
throw new RuntimeException("encrypt fail!", e);
}
}
-
+
public static String byte2hex(byte[] b) {
- String hs = "";
- String stmp = "";
- for (int n = 0; n < b.length; n++) {
- stmp = (Integer.toHexString(b[n] & 0XFF));
- if (stmp.length() == 1) {
- hs = hs + "0" + stmp;
- } else {
- hs = hs + stmp;
- }
- }
- return hs.toUpperCase();
- }
+ String hs = "";
+ String stmp = "";
+ for (int n = 0; n < b.length; n++) {
+ stmp = (Integer.toHexString(b[n] & 0XFF));
+ if (stmp.length() == 1) {
+ hs = hs + "0" + stmp;
+ } else {
+ hs = hs + stmp;
+ }
+ }
+ return hs.toUpperCase();
+ }
+
/**
- * @Description: 解密方法
- * @param data
- * 待解密内容
- * @param key
- * 解密密钥
+ * @param data 待解密内容
+ * @param key 解密密钥
* @return byte[]
* @throws
+ * @Description: 解密方法
*/
public static byte[] decrypt(byte[] data, byte[] key) {
if (key.length != 16) {
@@ -90,8 +79,8 @@ public class AES {
throw new RuntimeException("decrypt fail!", e);
}
}
-
- public static String decryptFromBase64(String data, String key){
+
+ public static String decryptFromBase64(String data, String key) {
try {
byte[] originalData = Base64.decode(data.getBytes());
byte[] valueByte = decrypt(originalData, key.getBytes(CHAR_ENCODING));
@@ -101,7 +90,7 @@ public class AES {
}
}
-
+
// public static void main(String[] args) throws Exception {
// String aesKey = "c8002313db99c1d1";
////
@@ -124,10 +113,10 @@ public class AES {
// System.out.println(result_hex);
// System.out.println(result_base64);
//
-//// System.out.print(1);
+
+ /// / System.out.print(1);
//
// }
-
public static void main(String[] args) {
// String mi = encrypt2base64("testAes", "c1953ld60041al21");
// System.out.println(" 密文为 === " + mi);
@@ -164,7 +153,7 @@ public class AES {
// System.out.println(encrypt2base64("16657136053", password));
// System.out.println(encrypt2base64("16657136053", password));
// System.out.println(decryptFromBase64("6B4VD+D9cEUvuLLWCK+eVQ==",password));
- System.out.println(encrypt2base64("13116719112", password));
- System.out.println(decryptFromBase64("qW5SnXhrGjGE0jQF9a1bSA==",password));
+ //System.out.println(encrypt2base64("13116719112", password));
+ System.out.println(decryptFromBase64("qW5SnXhrGjGE0jQF9a1bSA==", password));
}
}
diff --git a/src/test/java/com/lz/eb/Test2.java b/src/test/java/com/lz/eb/Test2.java
new file mode 100644
index 0000000..0fc4133
--- /dev/null
+++ b/src/test/java/com/lz/eb/Test2.java
@@ -0,0 +1,7 @@
+package com.lz.eb;
+
+public class Test2 {
+ public static void main(String[] args) {
+ System.out.println("xxxxxxxxxxxx");
+ }
+}