From a27ee11b35fe593d707e5e2b1517c04632db17b1 Mon Sep 17 00:00:00 2001
From: yexuejc <1107047387@qq.com>
Date: Mon, 9 Apr 2018 15:11:25 +0800
Subject: [PATCH] first commit
---
.gitignore | 24 +
LICENSE | 201 ++++++++
README.md | 51 ++
UPDATE.md | 23 +
pom.xml | 312 ++++++++++++
yexuejc-springboot-base/.gitignore | 24 +
yexuejc-springboot-base/mvnw | 225 +++++++++
yexuejc-springboot-base/mvnw.cmd | 143 ++++++
yexuejc-springboot-base/pom.xml | 94 ++++
.../MutiRedisAutoConfiguration.java | 463 ++++++++++++++++++
.../autoconfigure/OssAutoConfiguration.java | 32 ++
.../base/autoconfigure/OssFacade.java | 68 +++
.../base/autoconfigure/OssProperties.java | 49 ++
.../autoconfigure/WebAutoConfiguration.java | 114 +++++
.../springboot/base/constant/BizConsts.java | 72 +++
.../springboot/base/constant/RedisConsts.java | 15 +
.../base/filter/ValidationFilter.java | 71 +++
.../filter/ValidationFilterProperties.java | 59 +++
.../base/interceptor/LogInterceptor.java | 39 ++
.../yexuejc/springboot/base/pojo/PagerVO.java | 50 ++
.../yexuejc/springboot/base/util/LogUtil.java | 38 ++
.../yexuejc/springboot/base/util/NetUtil.java | 52 ++
.../springboot/base/util/ValidUtil.java | 42 ++
.../main/resources/META-INF/spring.factories | 4 +
.../src/main/resources/logback-spring.xml | 63 +++
.../springboot/base/ApplicationRun.java | 11 +
.../springboot/base/ApplicationTest.java | 17 +
.../src/test/resources/application.properties | 2 +
28 files changed, 2358 insertions(+)
create mode 100644 .gitignore
create mode 100644 LICENSE
create mode 100644 README.md
create mode 100644 UPDATE.md
create mode 100644 pom.xml
create mode 100644 yexuejc-springboot-base/.gitignore
create mode 100644 yexuejc-springboot-base/mvnw
create mode 100644 yexuejc-springboot-base/mvnw.cmd
create mode 100644 yexuejc-springboot-base/pom.xml
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/MutiRedisAutoConfiguration.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/OssAutoConfiguration.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/OssFacade.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/OssProperties.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/WebAutoConfiguration.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/constant/BizConsts.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/constant/RedisConsts.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ValidationFilter.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/filter/ValidationFilterProperties.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/interceptor/LogInterceptor.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/pojo/PagerVO.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/LogUtil.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/NetUtil.java
create mode 100644 yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/ValidUtil.java
create mode 100644 yexuejc-springboot-base/src/main/resources/META-INF/spring.factories
create mode 100644 yexuejc-springboot-base/src/main/resources/logback-spring.xml
create mode 100644 yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/ApplicationRun.java
create mode 100644 yexuejc-springboot-base/src/test/java/com/yexuejc/springboot/base/ApplicationTest.java
create mode 100644 yexuejc-springboot-base/src/test/resources/application.properties
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2af7cef
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,24 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+.nb-gradle/
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c2ad258
--- /dev/null
+++ b/README.md
@@ -0,0 +1,51 @@
+# yexuejc-base
+
+基于springboot maven 封装可继承基础工程
+
+### 目录
+
+
+
\src\main\java
+
核心代码
+
+
+
\src\main\resources
+
核心配置
+
+
+
com.yexuejc.base.autoconfigure.*
+
模块封装
+
+
+
com.yexuejc.base.constant.*
+
系统常量
+
+
+
com.yexuejc.base.filter.*
+
过滤器
+
+
+
com.yexuejc.base.interceptor.*
+
拦截器
+
+
+
com.yexuejc.base.http.*
+
网络层
+
+
+
com.yexuejc.base.pojo.*
+
bean
+
+
+
com.yexuejc.base.util.*
+
工具包
+
+
+
\src\test\
+
测试部分
+
+
+
com.yexuejc.base.ApplicationRun
+
测试启动入口
+
+
\ No newline at end of file
diff --git a/UPDATE.md b/UPDATE.md
new file mode 100644
index 0000000..36b1d2c
--- /dev/null
+++ b/UPDATE.md
@@ -0,0 +1,23 @@
+uselaw-base 更新内容
+-------------------
+
+#### 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
+**env:** ivt
+**update:**
+>1.第一次上传,集成通用环境
+
+#
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..ee64764
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,312 @@
+
+
+ 4.0.0
+
+ com.yexuejc.springboot
+ yexuejc-springboot-parent
+ 1.0.3
+ pom
+
+ ${project.artifactId}
+ yexuejc-springboot-parent project for Spring Boot
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.9.RELEASE
+
+
+
+
+ http://47.100.13.178:7081/nexus/content/groups/public
+ http://47.100.13.178:7081/nexus/content/groups/public
+ http://47.100.13.178:7081/nexus/content/repositories
+
+ http://maven.aliyun.com/nexus/content/groups/public
+ https://jitpack.io
+
+
+ true
+ 1.8
+ 1.1.0.Final
+ 2.2.2
+ 1.2.0
+ 3.4.2
+
+ 1.0.0
+ 0.7.0
+ 1.1.46
+ 1.10
+
+ 2.1.7
+ 2.1.6
+ 2.8.1
+ 1.0.0
+ 1.1.8
+
+ 20171023143759
+
+ 0.0.4
+ 9.4.1212
+
+ 3.0.9.RELEASE
+ 2.2.2
+ 3.0.2.RELEASE
+
+
+
+
+
+
+ com.github.yexuejc
+ yexuejc-base
+ ${yexuejc.base.version}
+
+
+
+
+
+
+
+
+ commons-codec
+ commons-codec
+ ${commons-codec.version}
+
+
+
+ io.jsonwebtoken
+ jjwt
+ ${jjwt.version}
+
+
+
+ com.alibaba
+ fastjson
+ ${fastjson.version}
+
+
+
+
+ javax.validation
+ validation-api
+ ${validation-api.version}
+
+
+
+ io.springfox
+ springfox-swagger2
+ ${springfox-swagger2.version}
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${springfox-swagger2.version}
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ ${mybatis-spring-boot-starter.version}
+
+
+
+ org.apache.tomcat
+ tomcat-jdbc
+
+
+
+
+
+ org.mybatis
+ mybatis
+ ${mybatis.version}
+
+
+
+ org.postgresql
+ postgresql
+ ${postgresql.version}
+
+
+
+
+
+ com.alipay
+ alipay-sdk-java
+ ${alipay-sdk-java.version}
+
+
+
+ com.github.wxpay
+ WXPay-SDK-Java
+ ${WXPay-SDK-Java.version}
+
+
+
+ com.aliyun
+ aliyun-java-sdk-core
+ ${aliyun-java-sdk-core.version}
+
+
+
+ com.aliyun
+ aliyun-java-sdk-sts
+ ${aliyun-java-sdk-sts.version}
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ ${aliyun-sdk-oss.version}
+
+
+
+ com.aliyun
+ aliyun-java-sdk-dysmsapi
+ ${aliyun-java-sdk-dysmsapi.version}
+
+
+
+ com.aliyun.mns
+ aliyun-sdk-mns
+ ${aliyun-sdk-mns.version}
+ jar-with-dependencies
+
+
+
+
+ de.codecentric
+ spring-boot-admin-starter-client
+ ${spring-boot-admin.version}
+
+
+ de.codecentric
+ spring-boot-admin-server
+ ${spring-boot-admin.version}
+
+
+ de.codecentric
+ spring-boot-admin-server-ui
+ ${spring-boot-admin.version}
+
+
+ de.codecentric
+ spring-boot-admin-server-ui-hystrix
+ ${spring-boot-admin.version}
+
+
+ de.codecentric
+ spring-boot-admin-server-ui-turbine
+ ${spring-boot-admin.version}
+
+
+ de.codecentric
+ spring-boot-admin-server-ui-activiti
+ ${spring-boot-admin.version}
+
+
+
+
+
+
+
+
+ ${project.artifactId}
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.0.1
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ build-info
+
+
+
+
+
+ false
+
+
+
+
+ maven-assembly-plugin
+
+ ${project.artifactId}-${project.version}
+
+
+
+ full
+ package
+
+ single
+
+
+ ${basedir}/assembly/assembly.xml
+
+
+
+
+
+
+
+
+
+
+
+ yexuejc-prod-nexus-public
+ yexuejc-prod-nexus-public
+ ${repos.yexuejc.prod.url}
+
+
+ yexuejc-ivt-nexus-public
+ yexuejc-ivt-nexus-public
+ ${repos.yexuejc.ivt.url}
+
+
+ aliyun-nexus-public
+ aliyun-nexus-public
+ ${repos.aliyun.url}
+
+
+ jitpack.io
+ ${repos.jitpack.url}
+
+
+
+
+
+ releases
+ nexus-release
+ ${repos.yexuejc.dist.url}/releases
+
+
+ snapshots
+ nexus-snapshots
+ ${repos.yexuejc.dist.url}/snapshots
+
+
+
+
+ yexuejc-springboot-base
+
+
diff --git a/yexuejc-springboot-base/.gitignore b/yexuejc-springboot-base/.gitignore
new file mode 100644
index 0000000..2af7cef
--- /dev/null
+++ b/yexuejc-springboot-base/.gitignore
@@ -0,0 +1,24 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+.nb-gradle/
\ No newline at end of file
diff --git a/yexuejc-springboot-base/mvnw b/yexuejc-springboot-base/mvnw
new file mode 100644
index 0000000..5bf251c
--- /dev/null
+++ b/yexuejc-springboot-base/mvnw
@@ -0,0 +1,225 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven2 Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Migwn, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+ # TODO classpath?
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`which java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+echo $MAVEN_PROJECTBASEDIR
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/yexuejc-springboot-base/mvnw.cmd b/yexuejc-springboot-base/mvnw.cmd
new file mode 100644
index 0000000..019bd74
--- /dev/null
+++ b/yexuejc-springboot-base/mvnw.cmd
@@ -0,0 +1,143 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven2 Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%
diff --git a/yexuejc-springboot-base/pom.xml b/yexuejc-springboot-base/pom.xml
new file mode 100644
index 0000000..872c230
--- /dev/null
+++ b/yexuejc-springboot-base/pom.xml
@@ -0,0 +1,94 @@
+
+
+ 4.0.0
+
+ yexuejc-springboot-base
+ jar
+
+
+ com.yexuejc.springboot
+ yexuejc-springboot-parent
+ 1.0.3
+
+
+
+
+ ${project.artifactId}
+
+
+
+
+
+
+
+
+ com.github.yexuejc
+ yexuejc-base
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+
+ com.aliyun
+ aliyun-java-sdk-core
+ true
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ true
+
+
+
+ io.jsonwebtoken
+ jjwt
+ true
+
+
+
+ org.springframework.data
+ spring-data-redis
+ true
+
+
+ redis.clients
+ jedis
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ true
+ test
+
+
+
+
+
+
+ maven-source-plugin
+
+
+
+
+
+
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
new file mode 100644
index 0000000..db1476c
--- /dev/null
+++ b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/autoconfigure/MutiRedisAutoConfiguration.java
@@ -0,0 +1,463 @@
+package com.yexuejc.springboot.base.autoconfigure;
+
+import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
+import org.springframework.boot.autoconfigure.data.redis.RedisProperties.Cluster;
+import org.springframework.boot.autoconfigure.data.redis.RedisProperties.Sentinel;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.annotation.Order;
+import org.springframework.data.redis.connection.RedisClusterConfiguration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.connection.RedisNode;
+import org.springframework.data.redis.connection.RedisSentinelConfiguration;
+import org.springframework.data.redis.connection.jedis.JedisConnection;
+import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
+import org.springframework.data.redis.core.RedisOperations;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPoolConfig;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Configuration
+@ConditionalOnClass({ JedisConnection.class, RedisOperations.class, Jedis.class })
+@EnableConfigurationProperties(RedisProperties.class)
+@Order(1)
+public class MutiRedisAutoConfiguration {
+
+ public static final String BEAN_REDIS_FACTORY0 = "redisConnectionFactory";
+ public static final String BEAN_REDIS_TEMPLATE0 = "redisTemplate";
+ public static final String BEAN_REDIS_STRING_TEMPLATE0 = "stringRedisTemplate";
+
+ public static final String BEAN_REDIS_FACTORY1 = "redis-factory-1";
+ public static final String BEAN_REDIS_TEMPLATE1 = "redis-template-1";
+ public static final String BEAN_REDIS_STRING_TEMPLATE1 = "redis-string-template-1";
+ public static final String BEAN_REDIS_FACTORY2 = "redis-factory-2";
+ public static final String BEAN_REDIS_TEMPLATE2 = "redis-template-2";
+ public static final String BEAN_REDIS_STRING_TEMPLATE2 = "redis-string-template-2";
+ public static final String BEAN_REDIS_FACTORY3 = "redis-factory-3";
+ public static final String BEAN_REDIS_TEMPLATE3 = "redis-template-3";
+ public static final String BEAN_REDIS_STRING_TEMPLATE3 = "redis-string-template-3";
+ public static final String BEAN_REDIS_FACTORY4 = "redis-factory-4";
+ public static final String BEAN_REDIS_TEMPLATE4 = "redis-template-4";
+ public static final String BEAN_REDIS_STRING_TEMPLATE4 = "redis-string-template-4";
+ public static final String BEAN_REDIS_FACTORY5 = "redis-factory-5";
+ public static final String BEAN_REDIS_TEMPLATE5 = "redis-template-5";
+ public static final String BEAN_REDIS_STRING_TEMPLATE5 = "redis-string-template-5";
+ public static final String BEAN_REDIS_FACTORY6 = "redis-factory-6";
+ public static final String BEAN_REDIS_TEMPLATE6 = "redis-template-6";
+ public static final String BEAN_REDIS_STRING_TEMPLATE6 = "redis-string-template-6";
+ public static final String BEAN_REDIS_FACTORY7 = "redis-factory-7";
+ public static final String BEAN_REDIS_TEMPLATE7 = "redis-template-7";
+ public static final String BEAN_REDIS_STRING_TEMPLATE7 = "redis-string-template-7";
+ public static final String BEAN_REDIS_FACTORY8 = "redis-factory-8";
+ public static final String BEAN_REDIS_TEMPLATE8 = "redis-template-8";
+ public static final String BEAN_REDIS_STRING_TEMPLATE8 = "redis-string-template-8";
+ public static final String BEAN_REDIS_FACTORY9 = "redis-factory-9";
+ public static final String BEAN_REDIS_TEMPLATE9 = "redis-template-9";
+ public static final String BEAN_REDIS_STRING_TEMPLATE9 = "redis-string-template-9";
+
+ /**
+ * Redis connection configuration.
+ */
+ @Configuration
+ @ConditionalOnClass(GenericObjectPool.class)
+ protected static class RedisConnectionConfiguration {
+
+ private final RedisProperties properties;
+
+ private final RedisSentinelConfiguration sentinelConfiguration;
+
+ private final RedisClusterConfiguration clusterConfiguration;
+
+ public RedisConnectionConfiguration(RedisProperties properties,
+ ObjectProvider sentinelConfiguration,
+ ObjectProvider clusterConfiguration) {
+ this.properties = properties;
+ this.sentinelConfiguration = sentinelConfiguration.getIfAvailable();
+ this.clusterConfiguration = clusterConfiguration.getIfAvailable();
+ }
+
+ @Primary
+ @Bean(BEAN_REDIS_FACTORY0)
+ @ConditionalOnProperty(name = "afound.redis.db0", matchIfMissing = true)
+ public JedisConnectionFactory redisConnectionFactory0() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 0);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY1)
+ @ConditionalOnProperty(name = "afound.redis.db1")
+ public JedisConnectionFactory redisConnectionFactory1() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 1);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY2)
+ @ConditionalOnProperty(name = "afound.redis.db2")
+ public JedisConnectionFactory redisConnectionFactory2() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 2);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY3)
+ @ConditionalOnProperty(name = "afound.redis.db3")
+ public JedisConnectionFactory redisConnectionFactory3() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 3);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY4)
+ @ConditionalOnProperty(name = "afound.redis.db4")
+ public JedisConnectionFactory redisConnectionFactory4() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 4);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY5)
+ @ConditionalOnProperty(name = "afound.redis.db5")
+ public JedisConnectionFactory redisConnectionFactory5() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 5);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY6)
+ @ConditionalOnProperty(name = "afound.redis.db6")
+ public JedisConnectionFactory redisConnectionFactory6() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 6);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY7)
+ @ConditionalOnProperty(name = "afound.redis.db7")
+ public JedisConnectionFactory redisConnectionFactory7() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 7);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY8)
+ @ConditionalOnProperty(name = "afound.redis.db8")
+ public JedisConnectionFactory redisConnectionFactory8() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 8);
+ }
+
+ @Bean(BEAN_REDIS_FACTORY9)
+ @ConditionalOnProperty(name = "afound.redis.db9")
+ public JedisConnectionFactory redisConnectionFactory9() throws UnknownHostException {
+ return applyProperties(createJedisConnectionFactory(), 9);
+ }
+
+ protected final JedisConnectionFactory applyProperties(JedisConnectionFactory factory, int database) {
+ configureConnection(factory);
+ if (this.properties.isSsl()) {
+ factory.setUseSsl(true);
+ }
+ factory.setDatabase(database);
+ if (this.properties.getTimeout() > 0) {
+ factory.setTimeout(this.properties.getTimeout());
+ }
+ return factory;
+ }
+
+ private void configureConnection(JedisConnectionFactory factory) {
+ if (StringUtils.hasText(this.properties.getUrl())) {
+ configureConnectionFromUrl(factory);
+ } else {
+ factory.setHostName(this.properties.getHost());
+ factory.setPort(this.properties.getPort());
+ if (this.properties.getPassword() != null) {
+ factory.setPassword(this.properties.getPassword());
+ }
+ }
+ }
+
+ private void configureConnectionFromUrl(JedisConnectionFactory factory) {
+ String url = this.properties.getUrl();
+ if (url.startsWith("rediss://")) {
+ factory.setUseSsl(true);
+ }
+ try {
+ URI uri = new URI(url);
+ factory.setHostName(uri.getHost());
+ factory.setPort(uri.getPort());
+ if (uri.getUserInfo() != null) {
+ String password = uri.getUserInfo();
+ int index = password.lastIndexOf(":");
+ if (index >= 0) {
+ password = password.substring(index + 1);
+ }
+ factory.setPassword(password);
+ }
+ } catch (URISyntaxException ex) {
+ throw new IllegalArgumentException("Malformed 'spring.redis.url' " + url, ex);
+ }
+ }
+
+ protected final RedisSentinelConfiguration getSentinelConfig() {
+ if (this.sentinelConfiguration != null) {
+ return this.sentinelConfiguration;
+ }
+ Sentinel sentinelProperties = this.properties.getSentinel();
+ if (sentinelProperties != null) {
+ RedisSentinelConfiguration config = new RedisSentinelConfiguration();
+ config.master(sentinelProperties.getMaster());
+ config.setSentinels(createSentinels(sentinelProperties));
+ return config;
+ }
+ return null;
+ }
+
+ /**
+ * Create a {@link RedisClusterConfiguration} if necessary.
+ *
+ * @return {@literal null} if no cluster settings are set.
+ */
+ protected final RedisClusterConfiguration getClusterConfiguration() {
+ if (this.clusterConfiguration != null) {
+ return this.clusterConfiguration;
+ }
+ if (this.properties.getCluster() == null) {
+ return null;
+ }
+ Cluster clusterProperties = this.properties.getCluster();
+ RedisClusterConfiguration config = new RedisClusterConfiguration(clusterProperties.getNodes());
+
+ if (clusterProperties.getMaxRedirects() != null) {
+ config.setMaxRedirects(clusterProperties.getMaxRedirects());
+ }
+ return config;
+ }
+
+ private List createSentinels(Sentinel sentinel) {
+ List nodes = new ArrayList();
+ for (String node : StringUtils.commaDelimitedListToStringArray(sentinel.getNodes())) {
+ try {
+ String[] parts = StringUtils.split(node, ":");
+ Assert.state(parts.length == 2, "Must be defined as 'host:port'");
+ nodes.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
+ } catch (RuntimeException ex) {
+ throw new IllegalStateException("Invalid redis sentinel " + "property '" + node + "'", ex);
+ }
+ }
+ return nodes;
+ }
+
+ private JedisConnectionFactory createJedisConnectionFactory() {
+ JedisPoolConfig poolConfig = this.properties.getPool() != null ? jedisPoolConfig() : new JedisPoolConfig();
+
+ if (getSentinelConfig() != null) {
+ return new JedisConnectionFactory(getSentinelConfig(), poolConfig);
+ }
+ if (getClusterConfiguration() != null) {
+ return new JedisConnectionFactory(getClusterConfiguration(), poolConfig);
+ }
+ return new JedisConnectionFactory(poolConfig);
+ }
+
+ private JedisPoolConfig jedisPoolConfig() {
+ JedisPoolConfig config = new JedisPoolConfig();
+ RedisProperties.Pool props = this.properties.getPool();
+ config.setMaxTotal(props.getMaxActive());
+ config.setMaxIdle(props.getMaxIdle());
+ config.setMinIdle(props.getMinIdle());
+ config.setMaxWaitMillis(props.getMaxWait());
+ return config;
+ }
+
+ }
+
+ /**
+ * Standard Redis configuration.
+ */
+ @Configuration
+ protected static class RedisConfiguration {
+
+ @Primary
+ @Bean(BEAN_REDIS_TEMPLATE0)
+ @ConditionalOnProperty(name = "afound.redis.db0", matchIfMissing = true)
+ public RedisTemplate