提交虚位以待
This commit is contained in:
parent
8b47502b89
commit
25d1260898
50
pom.xml
50
pom.xml
@ -9,9 +9,9 @@
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.lz.eb</groupId>
|
||||
<artifactId>eb-starter-parent</artifactId>
|
||||
<version>3.0.0.RELEASE</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.5.4</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
@ -19,24 +19,18 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
@ -45,17 +39,29 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-sleuth</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>18.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
@ -64,6 +70,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.75</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@ -75,26 +82,15 @@
|
||||
<artifactId>jsr305</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>com.netflix.ribbon</groupId>
|
||||
<artifactId>ribbon-loadbalancer</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.ribbon</groupId>
|
||||
<artifactId>ribbon-core</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-netflix-ribbon</artifactId>
|
||||
<version>2.2.2.RELEASE</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
@ -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 {
|
||||
//
|
||||
//
|
||||
//}
|
||||
@ -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;
|
||||
// }
|
||||
//}
|
||||
@ -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<Server> ss = this.getLoadBalancer().getAllServers();
|
||||
// List<Server> serverList = this.getPredicate().getEligibleServers(ss, key);
|
||||
// List<Server> servers = Lists.newArrayList();
|
||||
// Set<String> 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> server = getPredicate().chooseRoundRobinAfterFiltering(servers, key);
|
||||
// if (server.isPresent()) {
|
||||
// return server.get();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
@ -1,6 +1,5 @@
|
||||
package com.lz.eb.util.aes;
|
||||
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
@ -8,9 +7,7 @@ import java.io.UnsupportedEncodingException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author renlei
|
||||
*
|
||||
*/
|
||||
public class AES {
|
||||
public static final String CHAR_ENCODING = "UTF-8";
|
||||
@ -19,13 +16,11 @@ public class AES {
|
||||
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) {
|
||||
|
||||
@ -33,11 +28,6 @@ public class AES {
|
||||
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) {
|
||||
@ -67,14 +57,13 @@ public class AES {
|
||||
}
|
||||
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) {
|
||||
@ -124,10 +113,10 @@ public class AES {
|
||||
// System.out.println(result_hex);
|
||||
// System.out.println(result_base64);
|
||||
//
|
||||
|
||||
/// / 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(encrypt2base64("13116719112", password));
|
||||
System.out.println(decryptFromBase64("qW5SnXhrGjGE0jQF9a1bSA==", password));
|
||||
}
|
||||
}
|
||||
|
||||
7
src/test/java/com/lz/eb/Test2.java
Normal file
7
src/test/java/com/lz/eb/Test2.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.lz.eb;
|
||||
|
||||
public class Test2 {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("xxxxxxxxxxxx");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user