diff --git a/1.x-update.md b/1.x-update.md index dd5dc90..190243d 100644 --- a/1.x-update.md +++ b/1.x-update.md @@ -37,98 +37,8 @@ spring-boot-starter-parent:1.5.16.RELEASE 1. security多方登录第一个稳定版
支持账号登录、短信登录、第三方授权openid登录
功能链接[security重构-多方登录](doc/SECURITY.md) -# - -#### version :1.1.6-1.1.9 -**time:2018-11-21 15:03:01**
-**branch:** master
-**关联工程:**
-``` -springboot-base:1.2.1 -spring-boot-starter-parent:1.5.16.RELEASE -``` -**update:**
-1. security 登录开放处理 -# - -#### version :1.1.5 -**time:2018年11月20日20:26:06**
-**branch:** master
-**关联工程:**
-``` -springboot-base:1.2.1 -spring-boot-starter-parent:1.5.16.RELEASE -``` -**update:**
-1. 修复security登录 -# - -#### version :1.1.4 -**time:2018-11-9 16:55:53**
-**branch:** master
-**关联工程:**
-``` -springboot-base:1.2.1 -spring-boot-starter-parent:1.5.16.RELEASE -``` -**update:**
-1. 集成springboot security 多方登录 -2. 文档拆分 -# - - -#### version :1.1.3 -**time:2018-10-27 16:40:36**
-**branch:** master
-**关联工程:**
-``` -springboot-base:1.2.0 -spring-boot-starter-parent:1.5.16.RELEASE -``` -**update:**
-1. 日志优化,按天切割日志
-内置
-LogUtil.accessLogger.info(xxxx);请求访问控制,级别info[LogInterceptor->line39](com.yexuejc.springboot.base.interceptor.LogInterceptor)
-LogUtil.bizLogger.info(xxxx); 业务日志,级别trace
-LogUtil.exceptionLogger.error(xxxx);异常日志,级别error
-```$xslt -日志配置置于application.properties -详情参考 logback-spring.xml - -#日志contextName -spring.application.name=@pom.artifactId@ -#日志级别 -logging.level.root=info -#日志输出目录 -logging.path=/logs/yexuejc-springboot-parent - -``` -# - -#### version :1.1.2 -**time:2018-9-28 15:23:32**
-**branch:** master
-**关联工程:**
-``` -springboot-base:1.1.9 -spring-boot-starter-parent:1.5.16.RELEASE -``` -**update:**
-1. 新增声明包 -# - -#### version :1.1.1 -**time:2018-9-26 17:00:38**
-**branch:** master
-**关联工程:**
-``` -springboot-base:1.1.9 -spring-boot-starter-parent:1.5.16.RELEASE -``` -**update:**
-1. 升级依赖 -# +--- #### version :1.1.0 **time:2018-9-23 12:49:36**
**branch:** master
@@ -141,8 +51,8 @@ spring-boot-starter-parent:1.5.15.RELEASE 1. 升级依赖 2. 增加SSL证书忽略:默认关闭 3. 本版本更新工具依赖[https://github.com/yexuejc/yexuejc-base.git](https://github.com/yexuejc/yexuejc-base.git)不向下兼容 -# +--- #### version :1.0.15 **time:2018-9-3 19:29:39**
**branch:** master
@@ -153,8 +63,8 @@ spring-boot-starter-parent:1.5.15.RELEASE ``` **update:**
1. 升级依赖 -# +--- #### version :1.0.14 **time:2018-8-25 14:31:05**
**branch:** master
@@ -166,8 +76,8 @@ spring-boot-starter-parent:1.5.15.RELEASE **update:**
1. 升级依赖 2. 优化拦截规则:增加通配符 /** -# +--- #### version :1.0.13 **time:2018-8-17 11:41:18**
**branch:** master
@@ -177,8 +87,8 @@ springboot-base:1.1.7 ``` **update:**
1. 升级base -# +--- #### version :1.0.12 **time:2018-6-19 22:18:03**
**branch:** master
@@ -188,30 +98,32 @@ springboot-base:1.1.6 ``` **update:**
1. maven仓库更新 - +--- # #### version :1.0.11 **time:2018-6-19 22:18:03**
**branch:** master
**update:**
1. 更新springboot-base:1.1.5依赖 -# +--- #### version :1.0.10 **time:2018年6月14日22:31:18**
**branch:** master
**update:**
1. 更新springboot-base:1.1.4依赖 2. 统一编码:UTF-8 -# + +--- #### version :1.0.9 **time:2018年6月2日12:17:18**
**branch:** master
**update:**
1. 更新base依赖 -# + +--- #### version :1.0.8 **time:** 2018-5-4 09:54:18
**branch:** master
@@ -230,7 +142,7 @@ yexuejc.http.encrypt.private-alias=别名 yexuejc.http.encrypt.private-pwd=密码 ``` -# +--- ##### version :1.0.7 **time:** 2018-5-4 09:54:18
**branch:** master
@@ -238,7 +150,7 @@ yexuejc.http.encrypt.private-pwd=密码 >1. 新增加密证书配置 >2. RSA迁移到[yexuejc-base:1.1.1](https://github.com/yexuejc/yexuejc-base)工程 -# +--- ##### version :1.0.6 ~~1.0.5~~ **【change:2018-5-15 09:24:37】** 1.0.5 jitpack打包失败,升级版本1.0.6
**time:** 2018-5-4 09:54:18
@@ -247,32 +159,34 @@ yexuejc.http.encrypt.private-pwd=密码 > [使用加密解密](doc/PARAMS_RSA_DECRYPT_ENCRYPT.md) > >1.增加json入参解密、出参加密 -# + +--- ##### version :1.0.4 **time:** 2018-5-4 09:54:18
**branch:** master
**update:**
>1.更新springboot至1.5.12.RELEASE -# + +--- #### version :1.0.3 **time:** 2018-4-9 15:24:13
**branch:** master
**update:**
>1.变更包名 -# +--- #### version :1.0.2 **time:** 2018-4-1 17:00:15
**env:** prod
**update:**
>1.修复工具包ApiVO -# +--- #### version :0.0.2 **time:** 2018-1-31 13:48:34
**env:** ivt
**update:**
>1.集成日志【security】 -# +--- ##### version :0.0.1 **time:** 2018-1-31 12:16:10
@@ -280,4 +194,4 @@ yexuejc.http.encrypt.private-pwd=密码 **update:**
>1.第一次上传,集成通用环境 -# +--- diff --git a/2.x-update.md b/2.x-update.md index aa45899..9d64b3c 100644 --- a/2.x-update.md +++ b/2.x-update.md @@ -1,5 +1,31 @@ yexuejc-springboot 更新内容 ------------------- +#### version :2.1.3 +**time:2023-9-19 11:15:33**
+**branch:** 2.x
+**关联工程:**
+``` +springboot-base:1.5.0-jre8 +spring-boot-starter-parent:2.7.15 +``` +**update:**
+1. 全面更新依赖(时隔3年多,该项目又活了) +2. 保证原功能正常的最后一个版本 +3. 该版本基于JDK1.8 +--- + +#### version :2.1.2 +**time:2020-5-18 12:18:14**
+**branch:** master
+**关联工程:**
+``` +springboot-base:1.4.0 +spring-boot-starter-parent:1.5.16.RELEASE +``` +**update:**
+1. 更新依赖 +2. 更新仓库地址 https://nexus.yexuejc.club/ 为 https://nexus.yexuejc.top/ +--- #### version :2.1.1 **time:2019-11-1 13:32:07**
diff --git a/README.md b/README.md index 2808c22..4193da4 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ base:功能封装 #### 最新版本 * 1.x yexuejc.springboot.version=1.2.2
-* 2.x yexuejc.springboot.version=2.1.1
-* yexuejc.base.version=1.3.9 +* 2.x yexuejc.springboot.version=2.1.3
+* yexuejc.base.version=1.5.0-jre8 pom.xml ``` @@ -36,16 +36,16 @@ pom.xml - com.yexuejc.base + top.yexuejc yexuejc-base ${yexuejc.base.version} - yexuejc-nexus-public - yexuejc-nexus-public - https://nexus.yexuejc.club/repository/maven-public/ + yexuejc-maven + yexuejc maven + https://nexus.yexuejc.top/repository/maven-public/ ``` diff --git a/doc/MENU.md b/doc/MENU.md index 335b0bd..2bae09b 100644 --- a/doc/MENU.md +++ b/doc/MENU.md @@ -9,7 +9,15 @@ ### 内部集成 # -* [1.2.0/2.0.5 集成security登录第一个稳定版](SECURITY.md) +* [(2.0.3-2.0.5)新增 集成security多方登录](SECURITY.md) 单独使用例子工程:[https://github.com/yexuejc/springboot-security-login-simple](https://github.com/yexuejc/springboot-security-login-simple) * [1.0.6新增 针对API请求安全解决方案](PARAMS_RSA_DECRYPT_ENCRYPT.md)
* [1.0.6新增 加密功能](PARAMS_RSA_DECRYPT_ENCRYPT.md) + + +### 运行错误 +1. jdk版本问题,请切换jdk为1.8版或者jvm增加启动参数`--add-opens java.base/java.util=ALL-UNNAMED` +``` +Cannot load configuration class: com.example.demo.DemoApplication +Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @5af3afd9 +``` \ No newline at end of file diff --git a/pom.xml b/pom.xml index 16a5282..856d39c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.yexuejc.springboot yexuejc-springboot-parent - 2.1.0 + 2.1.3 pom ${project.artifactId} @@ -15,7 +15,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.5.RELEASE + 2.7.15 @@ -26,59 +26,57 @@ - 1.3.9 - https://nexus.yexuejc.club/repository/ - - http://maven.aliyun.com/nexus/content/groups/public - https://jitpack.io - - - true + UTF-8 + UTF-8 1.8 - 2.0.1.Final - 2.9.2 - 1.3.2 - 3.5.6 + ${java.version} + ${java.version} + true - 0.9.1 - 1.2.83 - 1.11 + 1.5.0-jre8 + ${project.version} + + 2.0.1.Final + 2.10.5 + 2.3.1 + 3.5.13 + + 0.11.5 + 1.2.49 + 1.15 - 4.1.1 - 3.0.0 - 3.1.0 - 1.1.0 - 1.1.8 + 4.6.4 + 3.1.1 + 3.17.1 + 2.2.1 + 1.1.9.2 - 3.3.49.ALL + 4.38.76.ALL 0.0.4 - 42.4.3 + 42.6.0 + 3.1.2.RELEASE + 3.3.0 + 3.0.5.RELEASE - 3.0.9.RELEASE - 2.3.0 - 3.0.2.RELEASE - - 1.09 - - 0.2.0 - 3.0.3 + 1.11.9 + 3.5.3.2 - - - - - top.yexuejc yexuejc-base ${yexuejc.base.version} + + com.yexuejc.springboot + yexuejc-springboot-base + ${yexuejc-springboot.version} + commons-codec @@ -88,15 +86,9 @@ io.jsonwebtoken - jjwt + jjwt-api ${jjwt.version} - - - com.alibaba - fastjson - ${fastjson.version} - @@ -193,11 +185,6 @@ reflectasm ${reflectasm.version} - - com.alibaba.boot - dubbo-spring-boot-starter - ${dubbo-spring-boot-starter.version} - com.baomidou @@ -279,35 +266,17 @@ - - - - yexuejc-nexus-public - yexuejc-nexus-public - ${repos.yexuejc.url}maven-public/ - - - aliyun-nexus-public - aliyun-nexus-public - ${repos.aliyun.url} - - - jitpack.io - ${repos.jitpack.url} - - releases nexus-release - ${repos.yexuejc.url}maven-releases/ + https://nexus.yexuejc.top/repository/maven-releases/ snapshots nexus-snapshots - ${repos.yexuejc.url}maven-snapshots/ + https://nexus.yexuejc.top/repository/maven-snapshots/ - diff --git a/yexuejc-springboot-base/pom.xml b/yexuejc-springboot-base/pom.xml index 4f1fa19..d09580a 100644 --- a/yexuejc-springboot-base/pom.xml +++ b/yexuejc-springboot-base/pom.xml @@ -9,27 +9,19 @@ com.yexuejc.springboot yexuejc-springboot-parent - 2.1.0 + 2.1.3 ${project.artifactId} - - - - top.yexuejc yexuejc-base - - - - @@ -65,7 +57,7 @@ io.jsonwebtoken - jjwt + jjwt-api true diff --git a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/MutiRedisAutoConfiguration.java b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/MutiRedisAutoConfiguration.java index 2fa0b77..b932d88 100644 --- a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/MutiRedisAutoConfiguration.java +++ b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/MutiRedisAutoConfiguration.java @@ -73,6 +73,7 @@ public class MutiRedisAutoConfiguration { @Configuration @ConditionalOnClass(GenericObjectPool.class) + @ConditionalOnProperty(name = "yexuejc.autoconfigure.redis.enable", matchIfMissing = false) protected static class RedisConnectionConfiguration { private final RedisProperties properties; @@ -163,6 +164,7 @@ public class MutiRedisAutoConfiguration { * Standard Redis configuration. */ @Configuration + @ConditionalOnProperty(name = "yexuejc.autoconfigure.redis.enable", matchIfMissing = false) protected static class RedisConfiguration { @Primary diff --git a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/security/domain/Consumer.java b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/security/domain/Consumer.java index bf7d8d2..2035f90 100644 --- a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/security/domain/Consumer.java +++ b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/security/domain/Consumer.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.yexuejc.base.util.JsonUtil; +import com.yexuejc.springboot.base.mapper.handler.JsonTypeHandler; import com.yexuejc.springboot.base.security.inte.User; import java.io.Serializable; @@ -27,7 +28,7 @@ public class Consumer extends Model implements User { /** * 用户id */ - @TableId(value = "consumer_id", type = IdType.UUID) + @TableId(value = "consumer_id", type = IdType.ASSIGN_UUID) private String consumerId; /** * 手机号 @@ -92,7 +93,7 @@ public class Consumer extends Model implements User { /** * 角色、权限 */ - @TableField(value = "roles", el = "roles,typeHandler=com.yexuejc.guansc.core.mybatis.handler.JsonTypeHandler") + @TableField(value = "roles", typeHandler = JsonTypeHandler.class) private List roles; /** * 支付密码 @@ -157,19 +158,16 @@ public class Consumer extends Model implements User { return this; } - public Consumer setEnable(boolean enable) { this.enable = enable; return this; } - public Consumer setNonExpire(boolean nonExpire) { this.nonExpire = nonExpire; return this; } - public Consumer setNonLock(boolean nonLock) { this.nonLock = nonLock; return this; @@ -276,7 +274,7 @@ public class Consumer extends Model implements User { } @Override - protected Serializable pkVal() { + public Serializable pkVal() { return this.consumerId; } } diff --git a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/ApplicationTest.java b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/ApplicationTest.java index 61ff94e..50f4cc6 100644 --- a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/ApplicationTest.java +++ b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/ApplicationTest.java @@ -7,11 +7,9 @@ import com.yexuejc.base.util.JsonUtil; import com.yexuejc.base.util.StrUtil; import com.yexuejc.springboot.base.ApplicationRun; import com.yexuejc.springboot.base.filter.RsaProperties; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.IOException; import java.security.KeyStoreException; @@ -19,14 +17,12 @@ import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.security.spec.InvalidKeySpecException; -import java.util.Base64; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = ApplicationRun.class) public class ApplicationTest { @Autowired @@ -76,10 +72,8 @@ public class ApplicationTest { // String strData = "HgTMgxEEFSr6zRLvZQ3U5CAKjJqwKf0lfruZTi32iWObkbJA5mHuOTKU4rXYkej4UsPfArYUA45GfxatwFoB4Q"; String strData = "K9Zyg82WDvIApFmXTxPwjQw_VA041jfBcxMIP6jpMM6xWe1XajGf3__7DqSLrS9MwCra9cYkidcjVJAKZn9cmQ"; - String mapData = "cEPfMp7-rim76XFdbNDSIzDRXyHySpz0VOZP6HC8U-JPl-ZxNZKp6ethEQWWITcuUPzIhp4fHiGKNsHA7F6OxCxibpMLj5-ZsgJJvcczw8Liens5kYgciRF1UziR3LFy6vybN9H1CJnqXaddbl3t_41P-_1l5Ev7YYa8woWp7ulaRPeTCDjohEpmx2Vi6aPSrm3hjjmitkD9gb0O6vFDNnclyNhFepKV3oh93tNv50sEQQ_QSBUXSHUtCnhTiBX8VsRX3h58F2tie7bG8VSk-6KFuXI07OiqFZSNpcwDOuq-GfMlEfPL3pX-gYhoOORPNClRlQHwyfHXBJly3gRtNVpVksHWQjr1xutWgYfwRjQPHBHNZwfx4E0XoCTuz9qH1CzFmmz68i63GzCM286zJ-J26MkiTDO1zH4jhglo38tnzz9HLeDcbbCuJg1jzkvpFiWamM-6odWhtCg65BS1tJJVWg023kWygZMu5Ebrm5WBbbatN87_K5zn211tFpKwRq2oVjO_AfJRY90WlQGEIHnzZNz_cf8mAjlmilHDuNdjYlj3axTUqLfgLDVaIkasREnjMI7oe8oAtG2ju2aq-xSAQZ_U-7-rsyBpoy0jnwRmlyUxhXgIX0zrfBQNXEjzPtg-iJ14R5qz1iOAJL7NtQQeuYngGTj6msDlKGEd_MQTLAFDbpiVPwWX00jLT1Ll3_zhivpPCUAmC8Yz58khkqrqi4FdIxJTDkxd0PFOBH8DYicF7ls4UdOHT24mAKDwUF_TfZ32oiiKSzCD9MJB8GEXjzx7tDFok-HsdOjI6ZnSUJCOTj3wne2E6_a8Gq2_vp5CWyW12wthJbH79aa7JVfy5cx-cZmNid7oCe54KYclz1tdUgLPCQ1ajsEevbRJ_NBkTmY2wAmUpHODeocDaYt_2AwAU2DLiv2uZuaVszNSUy593Zrzxq5AaY-oWbEeD24SyEWJObJtz5knYzr4NxjZShcjx9ezwiwkRZMtLZpA_cCPFAK1nOrN8zHCOZquS17CCSLDySLvGbxNqYeBa_lGSq8cQuQo8yybd1WkuLKUjUiJecmH2XcZNTPCtdRe0eLlRtk5928AQGsQugwSig"; - // String listData = "X65trOhRSpeaN-2qP0zhdYi2jeJDcrTz2JHkc6UFG17xAho-VO0fkD0cA8wxoxcqyTaulOiSzaidZ2VeIvKjuinlKT2r23kdMJxjJodOZojssxgGSxm5gnry2tq5X8dbP7n-jodvAvLE9Gtq7AaBQ36ZQBQ2RcFB3TiHKHGin0gfn6T6A80orYD7i-Bdc0rh_pBEdLwGt1wWY_C8QuxeBmMWh0jmLVfpa3ZZOXVc9I7wIxzc1taQ7f-8Om9SNfXc"; String listData = "Sf_FO8YC9EUNTeM0n9EVuDzwvLz3DcxOuG4-5UZ9486lLHAx7IOuAhPgVHpQGsQiqJ7Y3fTaWFr6rRFPL12rVg"; @@ -107,7 +101,6 @@ public class ApplicationTest { ) ).isEqualTo("f721e7b0d5415302f5fe7dc5beb2938a"); - //list assertThat( StrUtil.toMD5( @@ -120,7 +113,6 @@ public class ApplicationTest { } - /** * 证书操作 * @@ -142,15 +134,13 @@ public class ApplicationTest { // String dataStr = "{\"ret\":\"0\",\"expireTime\":\"2015/10/28 23:59:59\",\"rettxt\":\"OK\",\"token\":\"69296128A59798E2D423D3B1A9F766F4\"}"; String dataStr = "{\"foodsCode\":\"49\",\"latlng\":\"22.5,114.0\",\"pageIndex\":1,\"pageSize\":10}"; - - /***************************************************************************************************************************************************************************************************************************************/ //客户端公钥加密 // String publicEncryptResult = RSA.publicEncrypt(dataStr, RSA2.getPublicKey(publicKey)); // System.out.println(publicEncryptResult); // System.out.println(StrUtil.toMD5(dataStr)); - String publicEncryptResult="KHAtNzGkT/Mn7d/Ei6aoZ8KCA04mYJi5b/sxt/Jgzq76jNi0O/EMACDsipgQuwZTJrrys5xOPyy4\n1Gf8LMEldZE3GeY3i92A5jnH7IeWnLojYhNaKdIuLuf4l5uJmFgpzxhoxqSkp2JJ5Vbt8j5Hy4ov\n7tfxPDBwnT6FSfDqGLU\u003d\n"; + String publicEncryptResult = "KHAtNzGkT/Mn7d/Ei6aoZ8KCA04mYJi5b/sxt/Jgzq76jNi0O/EMACDsipgQuwZTJrrys5xOPyy4\n1Gf8LMEldZE3GeY3i92A5jnH7IeWnLojYhNaKdIuLuf4l5uJmFgpzxhoxqSkp2JJ5Vbt8j5Hy4ov\n7tfxPDBwnT6FSfDqGLU\u003d\n"; //服务器私钥解密 String privateDecryptResult = RSA.privateDecrypt(publicEncryptResult, RSA2.getPrivateKey(privateKey, privateAlias, privatePwd)); @@ -168,9 +158,9 @@ public class ApplicationTest { } - /** * key加解密 + * * @throws NoSuchAlgorithmException * @throws InvalidKeySpecException */ @@ -179,7 +169,6 @@ public class ApplicationTest { String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCX9uSsfJeIDIPzxCtwwFh5vrIKar69i3DPUTDEiKPRdtmADa8Ls6KAsPVpzgtQYoYVpYBoMbBtp0cGRoQULO83NWIAhmsU2cvd0nmGlB2xPRz+uGYW1rsYyCM8RSvfAwCVNsJD10A9voLhRQuYHPIDmay1sBA/casvEvYwMqDZtQIDAQAB"; System.out.println(publicKey.length()); - // String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAiSo5blJ9-QJ0_QElcy5AaRTq-3oO4lJ8PvIOIt-Xr5SUFODVj3DUbiy6_0bxQYO3NiYHlXPb37UVV3jjlXJsXwIDAQABAkBE0WOJH2hGs93gRl_0vwLf9ffDfkTTdlER_73p70aad3QZRslEkinQH7G5aE_DgBm5m72TCeH-PD2FZ2lwtavBAiEAvnRown5Lpqbl0tN_OUxr_e1u9d_-8dNL_JEETO7BZCECIQC4XtY-18j0bVVLxaXPjKQ00D59yntwObihDNyRK0nAfwIgHPHEGgrnpGQo-Wl7JFIg925mNqfcLxRVsAS6CpcefQECIQCUsLdsmy6QIhTmNRJSXoSXq1KatE_05DhIekzwLs8eFQIgfMawMiu52ZxBI5_pZ7ancQZ6Dsxl45utFqJShzV1pio"; //// String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIkqOW5SffkCdP0BJXMuQGkU6vt6DuJSfD7yDiLfl6-UlBTg1Y9w1G4suv9G8UGDtzYmB5Vz29-1FVd445VybF8CAwEAAQ"; // String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCX9uSsfJeIDIPzxCtwwFh5vrIKar69i3DPUTDEiKPRdtmADa8Ls6KAsPVpzgtQYoYVpYBoMbBtp0cGRoQULO83NWIAhmsU2cvd0nmGlB2xPRz+uGYW1rsYyCM8RSvfAwCVNsJD10A9voLhRQuYHPIDmay1sBA/casvEvYwMqDZtQIDAQAB"; diff --git a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/KeyStoreHelper.java b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/KeyStoreHelper.java index c9318e4..b93fd2f 100644 --- a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/KeyStoreHelper.java +++ b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/KeyStoreHelper.java @@ -1,7 +1,5 @@ package com.yexuejc.springboot.base.test; -import sun.misc.BASE64Encoder; - import java.io.*; import java.security.KeyStore; import java.security.PrivateKey; @@ -9,8 +7,11 @@ import java.security.PublicKey; import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; +import java.util.Base64; + /** * 生成公钥工具; http://bijian1013.iteye.com/blog/2339874 + * * @ClassName: KeyStoreHelper * @Description: * @author: maxf @@ -33,7 +34,7 @@ public class KeyStoreHelper { byte[] publicKeyBytes = publicKey.getEncoded(); // byte[] privateKeyBytes = privateKey.getEncoded(); - String publicKeyBase64 = new BASE64Encoder().encode(publicKeyBytes); + String publicKeyBase64 = Base64.getEncoder().encodeToString(publicKeyBytes); // String privateKeyBase64 = new BASE64Encoder().encode(privateKeyBytes); System.out.println("publicKeyBase64.length():" + publicKeyBase64.length()); diff --git a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/MnsTest.java b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/MnsTest.java index 9df5d21..55641c8 100644 --- a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/MnsTest.java +++ b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/MnsTest.java @@ -4,11 +4,9 @@ import com.aliyun.mns.model.Message; import com.yexuejc.base.util.JsonUtil; import com.yexuejc.base.util.StrUtil; import com.yexuejc.springboot.base.autoconfigure.MnsFacade; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import java.util.HashMap; import java.util.Map; @@ -20,7 +18,6 @@ import java.util.Map; * @Description * @date 2018/11/1 14:25 */ -@RunWith(SpringRunner.class) @SpringBootTest public class MnsTest { diff --git a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/OssTest.java b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/OssTest.java index b1250b4..ebce9ea 100644 --- a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/OssTest.java +++ b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/OssTest.java @@ -6,11 +6,9 @@ import com.yexuejc.base.util.StrUtil; import com.yexuejc.springboot.base.autoconfigure.OssFacade; import com.yexuejc.springboot.base.exception.ImageException; import com.yexuejc.springboot.base.util.LogUtil; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -23,7 +21,6 @@ import java.io.InputStream; * @Description * @date 2018/11/1 14:58 */ -@RunWith(SpringRunner.class) @SpringBootTest public class OssTest { @Autowired @@ -32,11 +29,11 @@ public class OssTest { /** * 上传图片到oss *

- * 这里是模拟微信登录时,获取到微信头像地址,缓存到base64,然后上传到OSS + * 这里是模拟微信登录时,获取到微信头像地址,缓存到base64,然后上传到OSS *

*/ @Test - public void put(){ + public void put() { putOss4Head(null, "https://avatar.csdn.net/7/8/1/3_wulex.jpg"); } diff --git a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/RedisTest.java b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/RedisTest.java index 2d4ada4..4a92c40 100644 --- a/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/RedisTest.java +++ b/yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/test/RedisTest.java @@ -3,8 +3,7 @@ package com.yexuejc.springboot.base.test; import com.yexuejc.base.util.JsonUtil; import com.yexuejc.base.util.StrUtil; import com.yexuejc.springboot.base.autoconfigure.MutiRedisAutoConfiguration; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; @@ -24,7 +23,6 @@ import java.util.concurrent.TimeUnit; * @Description * @date 2018/11/1 11:16 */ -@RunWith(SpringRunner.class) @SpringBootTest public class RedisTest { /** diff --git a/yexuejc-springboot-base/src/test/resources/application.properties b/yexuejc-springboot-base/src/test/resources/application.properties index 528fd55..400aa7c 100644 --- a/yexuejc-springboot-base/src/test/resources/application.properties +++ b/yexuejc-springboot-base/src/test/resources/application.properties @@ -73,9 +73,9 @@ yexuejc.redis.db1=true spring.redis.jedis.pool.max-active=100 spring.redis.jedis.pool.max-idle=10 spring.redis.jedis.pool.min-idle=3 -spring.redis.host=121.42.165.89 -spring.redis.password= -spring.redis.port=16379 +spring.redis.host=192.168.0.107 +spring.redis.password=yexuejc2022 +spring.redis.port=6379 #db diff --git a/yexuejc-springboot-example/springboot-security-login-simple/pom.xml b/yexuejc-springboot-example/springboot-security-login-simple/pom.xml index ef0b811..e08795a 100644 --- a/yexuejc-springboot-example/springboot-security-login-simple/pom.xml +++ b/yexuejc-springboot-example/springboot-security-login-simple/pom.xml @@ -13,14 +13,16 @@ https://gitee.com/incloudcode/yexuejc-springboot使用例子 + + ${parent.version} + + com.yexuejc.springboot yexuejc-springboot-parent - 2.1.0 + 2.1.3 - - 1.3.9 - + @@ -32,7 +34,6 @@ top.yexuejc yexuejc-base - ${yexuejc.base.version} @@ -47,7 +48,7 @@ io.jsonwebtoken - jjwt + jjwt-api true @@ -80,13 +81,6 @@ test - - - yexuejc-nexus-public - yexuejc-nexus-public - https://nexus.yexuejc.club/repository/maven-public/ - - diff --git a/yexuejc-springboot-example/springboot-security-login-simple/src/main/java/com/example/demo/security/domain/Consumer.java b/yexuejc-springboot-example/springboot-security-login-simple/src/main/java/com/example/demo/security/domain/Consumer.java index dd4b35e..ce29c1e 100644 --- a/yexuejc-springboot-example/springboot-security-login-simple/src/main/java/com/example/demo/security/domain/Consumer.java +++ b/yexuejc-springboot-example/springboot-security-login-simple/src/main/java/com/example/demo/security/domain/Consumer.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.example.demo.mapper.handler.JsonTypeHandler; import com.yexuejc.base.util.JsonUtil; import com.yexuejc.springboot.base.security.inte.User; @@ -27,7 +28,7 @@ public class Consumer extends Model implements User { /** * 用户id */ - @TableId(value = "consumer_id", type = IdType.UUID) + @TableId(value = "consumer_id", type = IdType.ASSIGN_UUID) private String consumerId; /** * 手机号 @@ -92,7 +93,7 @@ public class Consumer extends Model implements User { /** * 角色、权限 */ - @TableField(value = "roles", el = "roles,typeHandler=com.yexuejc.guansc.core.mybatis.handler.JsonTypeHandler") + @TableField(value = "roles", typeHandler = JsonTypeHandler.class) private List roles; /** * 支付密码 @@ -157,19 +158,16 @@ public class Consumer extends Model implements User { return this; } - public Consumer setEnable(boolean enable) { this.enable = enable; return this; } - public Consumer setNonExpire(boolean nonExpire) { this.nonExpire = nonExpire; return this; } - public Consumer setNonLock(boolean nonLock) { this.nonLock = nonLock; return this; @@ -275,7 +273,7 @@ public class Consumer extends Model implements User { } @Override - protected Serializable pkVal() { + public Serializable pkVal() { return this.consumerId; } } diff --git a/yexuejc-springboot-example/springboot-security-login-simple/src/main/resources/application.properties b/yexuejc-springboot-example/springboot-security-login-simple/src/main/resources/application.properties index c13c487..747da9e 100644 --- a/yexuejc-springboot-example/springboot-security-login-simple/src/main/resources/application.properties +++ b/yexuejc-springboot-example/springboot-security-login-simple/src/main/resources/application.properties @@ -1,3 +1,4 @@ +server.port=8545 logging.level.root=info #======================================================================================================================== @@ -27,9 +28,9 @@ yexuejc.redis.db1=true spring.redis.jedis.pool.max-active=100 spring.redis.jedis.pool.max-idle=10 spring.redis.jedis.pool.min-idle=3 -spring.redis.host=121.42.165.89 -spring.redis.password= -spring.redis.port=16379 +spring.redis.host=192.168.0.107 +spring.redis.password=yexuejc2022 +spring.redis.port=6379 #db diff --git a/yexuejc-springboot-example/springboot-security-login-simple/src/test/java/com/example/demo/DemoApplicationTests.java b/yexuejc-springboot-example/springboot-security-login-simple/src/test/java/com/example/demo/DemoApplicationTests.java index 480d1ca..392e910 100644 --- a/yexuejc-springboot-example/springboot-security-login-simple/src/test/java/com/example/demo/DemoApplicationTests.java +++ b/yexuejc-springboot-example/springboot-security-login-simple/src/test/java/com/example/demo/DemoApplicationTests.java @@ -1,11 +1,8 @@ package com.example.demo; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -@RunWith(SpringRunner.class) @SpringBootTest public class DemoApplicationTests { diff --git a/yexuejc-springboot-example/yexuejc-springboot-simple/pom.xml b/yexuejc-springboot-example/yexuejc-springboot-simple/pom.xml index 241447d..cd2e129 100644 --- a/yexuejc-springboot-example/yexuejc-springboot-simple/pom.xml +++ b/yexuejc-springboot-example/yexuejc-springboot-simple/pom.xml @@ -5,7 +5,7 @@ com.yexuejc.springboot yexuejc-springboot-parent - 2.1.0 + 2.1.3 top.yexuejc yexuejc-springboot-simple @@ -14,14 +14,13 @@ 测试工程 - 1.8 + ${parent.version} com.yexuejc.springboot yexuejc-springboot-base - ${parent.version} org.springframework.boot diff --git a/yexuejc-springboot-example/yexuejc-springboot-simple/src/test/java/top/yexuejc/springboot/simple/YexuejcSpringbootSimpleApplicationTests.java b/yexuejc-springboot-example/yexuejc-springboot-simple/src/test/java/top/yexuejc/springboot/simple/YexuejcSpringbootSimpleApplicationTests.java index 7fe783b..48a8ab3 100644 --- a/yexuejc-springboot-example/yexuejc-springboot-simple/src/test/java/top/yexuejc/springboot/simple/YexuejcSpringbootSimpleApplicationTests.java +++ b/yexuejc-springboot-example/yexuejc-springboot-simple/src/test/java/top/yexuejc/springboot/simple/YexuejcSpringbootSimpleApplicationTests.java @@ -1,11 +1,8 @@ package top.yexuejc.springboot.simple; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -@RunWith(SpringRunner.class) @SpringBootTest public class YexuejcSpringbootSimpleApplicationTests {