mirror of
https://gitee.com/incloudcode/yexuejc-springboot.git
synced 2025-11-18 20:47:43 +08:00
Compare commits
4 Commits
1c821ef840
...
2.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 85362e6537 | |||
| 73b767786f | |||
| 8e86b352ac | |||
| 8e39507e18 |
@@ -1,9 +1,8 @@
|
||||
# yexuejc-springboot
|
||||
|
||||
### 说明
|
||||
>基于springboot版本分别维护1.x(对应springboot1.5.16.RELEASE) 2.x(对应springboot2.0.5.RELEASE) 分支 <br>
|
||||
>master将继续同步1.x分支(后期获取会同步于2.x)
|
||||
|
||||
>本分支基于 springboot 2.x 开发,版本号也将保持2.x
|
||||
>1.x分支继续基于 springboot 1.x开发
|
||||
|
||||
#### 项目介绍
|
||||
基于springboot maven 封装可继承基础工程
|
||||
@@ -13,8 +12,8 @@ parent:版本封装<br/>
|
||||
base:功能封装
|
||||
|
||||
#### 最新版本
|
||||
* yexuejc.springboot.version=1.2.1 <br>
|
||||
* yexuejc.base.version=1.3.9
|
||||
>yexuejc.springboot.version=2.1.1 <br>
|
||||
>yexuejc.base.version=1.3.9
|
||||
|
||||
pom.xml
|
||||
```
|
||||
|
||||
99
UPDATE.md
99
UPDATE.md
@@ -1,77 +1,81 @@
|
||||
yexuejc-springboot 更新内容
|
||||
-------------------
|
||||
|
||||
#### version :1.2.1
|
||||
**time:2019-7-27 09:39:24** <br/>
|
||||
#### version :2.1.1
|
||||
**time:2019-11-1 13:32:07** <br/>
|
||||
**branch:** master <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.3.9
|
||||
spring-boot-starter-parent:1.5.16.RELEASE
|
||||
spring-boot-starter-parent:2.0.5.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. redis 配置修改,增加开关,更兼容
|
||||
|
||||
#### version :2.1.0
|
||||
**time:2019-7-24 18:30:49** <br/>
|
||||
**branch:** master <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.3.9
|
||||
spring-boot-starter-parent:2.0.5.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. 所有自动装配增加开关,默认不装配。装配方式请参考[本项目自动装配开关](doc/plugin/AutoConfigure.md)
|
||||
|
||||
|
||||
#
|
||||
#### version :1.2.0
|
||||
**time:2018-12-1 12:19:06** <br/>
|
||||
#### version :2.0.6
|
||||
**time:2019年4月2日21:08:453** <br/>
|
||||
**branch:** master <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.3.9
|
||||
spring-boot-starter-parent:2.0.5.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. 升级依赖
|
||||
2. 出入参加密 ParamsRequestBodyAdvice/ParamsResponseBodyAdvice 增加开关(默认关)
|
||||
|
||||
|
||||
#
|
||||
|
||||
#### version :2.0.5
|
||||
**time:2018-12-1 12:27:10** <br/>
|
||||
**branch:** master <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.2.4
|
||||
spring-boot-starter-parent:1.5.16.RELEASE
|
||||
spring-boot-starter-parent:2.0.5.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. security多方登录第一个稳定版<br/>
|
||||
支持账号登录、短信登录、第三方授权openid登录<br/>
|
||||
功能链接[security重构-多方登录](doc/SECURITY.md)
|
||||
#
|
||||
|
||||
#### version :1.1.6-1.1.9
|
||||
**time:2018-11-21 15:03:01** <br/>
|
||||
|
||||
#
|
||||
#### version :2.0.3
|
||||
**time:2018-11-9 16:58:06** <br/>
|
||||
**branch:** master <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.2.1
|
||||
spring-boot-starter-parent:1.5.16.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. security 登录开放处理
|
||||
#
|
||||
|
||||
#### version :1.1.5
|
||||
**time:2018年11月20日20:26:06** <br/>
|
||||
**branch:** master <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.2.1
|
||||
spring-boot-starter-parent:1.5.16.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. 修复security登录
|
||||
#
|
||||
|
||||
#### version :1.1.4
|
||||
**time:2018-11-9 16:55:53** <br/>
|
||||
**branch:** master <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.2.1
|
||||
spring-boot-starter-parent:1.5.16.RELEASE
|
||||
spring-boot-starter-parent:2.0.5.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. 集成springboot security 多方登录
|
||||
2. 文档拆分
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
#### version :1.1.3
|
||||
**time:2018-10-27 16:40:36** <br/>
|
||||
#### version :2.0.2
|
||||
**time:2018-10-27 16:42:08** <br/>
|
||||
**branch:** master <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.2.0
|
||||
spring-boot-starter-parent:1.5.16.RELEASE
|
||||
spring-boot-starter-parent:2.0.5.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. 日志优化,按天切割日志<br>
|
||||
@@ -93,28 +97,29 @@ logging.path=/logs/yexuejc-springboot-parent
|
||||
```
|
||||
#
|
||||
|
||||
#### version :1.1.2
|
||||
**time:2018-9-28 15:23:32** <br/>
|
||||
**branch:** master <br/>
|
||||
#### version :2.0.1
|
||||
**time:2018-9-28 15:25:30** <br/>
|
||||
**branch:** 2.x <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.1.9
|
||||
spring-boot-starter-parent:1.5.16.RELEASE
|
||||
spring-boot-starter-parent:2.0.5.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. 新增声明包
|
||||
#
|
||||
|
||||
#### version :1.1.1
|
||||
**time:2018-9-26 17:00:38** <br/>
|
||||
**branch:** master <br/>
|
||||
#### version :2.0.0
|
||||
**time:2018-9-26 16:55:00** <br/>
|
||||
**branch:** 2.x <br/>
|
||||
**关联工程:** <br/>
|
||||
```
|
||||
springboot-base:1.1.9
|
||||
spring-boot-starter-parent:1.5.16.RELEASE
|
||||
spring-boot-starter-parent:2.0.5.RELEASE
|
||||
```
|
||||
**update:** <br/>
|
||||
1. 升级依赖
|
||||
2. 2.x分支将基于springboot 2.x 开发
|
||||
#
|
||||
|
||||
#### version :1.1.0
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
### 内部集成
|
||||
#
|
||||
* 1.2.1 项目所集成的插件都增加开关-默认关闭,升级版本请阅读[第三方集成具体使用](plugin/AutoConfigure.md)
|
||||
* [1.1.4新增 集成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)<br/>
|
||||
* [1.0.6新增 加密功能](PARAMS_RSA_DECRYPT_ENCRYPT.md)
|
||||
|
||||
16
pom.xml
16
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.yexuejc.springboot</groupId>
|
||||
<artifactId>yexuejc-springboot-parent</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>2.1.1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
@@ -15,10 +15,16 @@
|
||||
<!-- spring boot父级,包含了统一版本管理,统一插件管理等 -->
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.16.RELEASE</version>
|
||||
<!-- <relativePath/> lookup parent from repository -->
|
||||
<version>2.0.5.RELEASE</version>
|
||||
<!--<relativePath/>-->
|
||||
<!--lookup parent from repository-->
|
||||
</parent>
|
||||
|
||||
|
||||
<modules>
|
||||
<module>yexuejc-springboot-base</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<yexuejc.base.version>1.3.9</yexuejc.base.version>
|
||||
<repos.yexuejc.url>https://nexus.yexuejc.club/repository/</repos.yexuejc.url>
|
||||
@@ -304,8 +310,4 @@
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<modules>
|
||||
<module>yexuejc-springboot-base</module>
|
||||
<module>yexuejc-springboot-example</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
<parent>
|
||||
<groupId>com.yexuejc.springboot</groupId>
|
||||
<artifactId>yexuejc-springboot-parent</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>2.1.1</version>
|
||||
<!-- 本地打包:使用相对关联路径 -->
|
||||
<!--<relativePath>../../yexuejc</relativePath>-->
|
||||
<!--<relativePath>../</relativePath>-->
|
||||
</parent>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
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.RedisPassword;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.data.redis.connection.jedis.JedisClientConfiguration;
|
||||
import org.springframework.data.redis.connection.jedis.JedisConnection;
|
||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisOperations;
|
||||
@@ -24,25 +21,17 @@ 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;
|
||||
|
||||
/**
|
||||
* 对redis 多个databasse封装
|
||||
* 多个database配置
|
||||
*
|
||||
* @author maxf
|
||||
* @version 1.0
|
||||
* @ClassName MutiRedisAutoConfiguration
|
||||
* @PackageName com.yexuejc.springboot.base.autoconfigure
|
||||
* @Description
|
||||
* @date 2018/11/1 10:31
|
||||
* @date 2018/9/26 15:27
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({JedisConnection.class, RedisOperations.class, Jedis.class})
|
||||
@@ -50,7 +39,6 @@ import java.util.List;
|
||||
@Order(1)
|
||||
@ConditionalOnProperty(name = "yexuejc.autoconfigure.redis.enable", matchIfMissing = false)
|
||||
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";
|
||||
@@ -83,211 +71,100 @@ public class MutiRedisAutoConfiguration {
|
||||
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)
|
||||
@ConditionalOnProperty(name = "yexuejc.autoconfigure.redis.enable", matchIfMissing = false)
|
||||
protected static class RedisConnectionConfiguration {
|
||||
|
||||
private final RedisProperties properties;
|
||||
|
||||
private final RedisSentinelConfiguration sentinelConfiguration;
|
||||
|
||||
private final RedisClusterConfiguration clusterConfiguration;
|
||||
|
||||
public RedisConnectionConfiguration(RedisProperties properties,
|
||||
ObjectProvider<RedisSentinelConfiguration> sentinelConfiguration,
|
||||
ObjectProvider<RedisClusterConfiguration> clusterConfiguration) {
|
||||
public RedisConnectionConfiguration(RedisProperties properties) {
|
||||
this.properties = properties;
|
||||
this.sentinelConfiguration = sentinelConfiguration.getIfAvailable();
|
||||
this.clusterConfiguration = clusterConfiguration.getIfAvailable();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(BEAN_REDIS_FACTORY0)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db0", matchIfMissing = true)
|
||||
public JedisConnectionFactory redisConnectionFactory0() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 0);
|
||||
return createJedisConnectionFactory(0);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY1)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db1")
|
||||
public JedisConnectionFactory redisConnectionFactory1() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 1);
|
||||
return createJedisConnectionFactory(1);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY2)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db2")
|
||||
public JedisConnectionFactory redisConnectionFactory2() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 2);
|
||||
return createJedisConnectionFactory(2);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY3)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db3")
|
||||
public JedisConnectionFactory redisConnectionFactory3() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 3);
|
||||
return createJedisConnectionFactory(3);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY4)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db4")
|
||||
public JedisConnectionFactory redisConnectionFactory4() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 4);
|
||||
return createJedisConnectionFactory(4);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY5)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db5")
|
||||
public JedisConnectionFactory redisConnectionFactory5() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 5);
|
||||
return createJedisConnectionFactory(5);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY6)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db6")
|
||||
public JedisConnectionFactory redisConnectionFactory6() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 6);
|
||||
return createJedisConnectionFactory(6);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY7)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db7")
|
||||
public JedisConnectionFactory redisConnectionFactory7() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 7);
|
||||
return createJedisConnectionFactory(7);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY8)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db8")
|
||||
public JedisConnectionFactory redisConnectionFactory8() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 8);
|
||||
return createJedisConnectionFactory(8);
|
||||
}
|
||||
|
||||
@Bean(BEAN_REDIS_FACTORY9)
|
||||
@ConditionalOnProperty(name = "yexuejc.redis.db9")
|
||||
public JedisConnectionFactory redisConnectionFactory9() throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory(), 9);
|
||||
return 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());
|
||||
}
|
||||
private JedisConnectionFactory createJedisConnectionFactory(int database) {
|
||||
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration();
|
||||
redisStandaloneConfiguration.setHostName(properties.getHost());
|
||||
redisStandaloneConfiguration.setPort(properties.getPort());
|
||||
redisStandaloneConfiguration.setDatabase(database);
|
||||
redisStandaloneConfiguration.setPassword(RedisPassword.of(properties.getPassword()));
|
||||
|
||||
JedisClientConfiguration.JedisClientConfigurationBuilder jedisClientConfiguration = JedisClientConfiguration.builder();
|
||||
|
||||
JedisConnectionFactory factory = new JedisConnectionFactory(redisStandaloneConfiguration,
|
||||
jedisClientConfiguration.build());
|
||||
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<RedisNode> createSentinels(Sentinel sentinel) {
|
||||
List<RedisNode> nodes = new ArrayList<RedisNode>();
|
||||
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
|
||||
@ConditionalOnProperty(name = "yexuejc.autoconfigure.redis.enable", matchIfMissing = false)
|
||||
protected static class RedisConfiguration {
|
||||
|
||||
@Primary
|
||||
@@ -469,5 +346,4 @@ public class MutiRedisAutoConfiguration {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.yexuejc.springboot.base.util.LogUtil;
|
||||
import com.yexuejc.springboot.base.util.SSLUtil;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnResource;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
|
||||
@@ -5,28 +5,46 @@ spring.application.name=@pom.artifactId@
|
||||
logging.level.root=info
|
||||
logging.path=/logs/yexuejc-springboot-parent
|
||||
|
||||
|
||||
#========================================================================================================================
|
||||
#========================================================================================================================
|
||||
#核心
|
||||
#开启功能 redis webmvc
|
||||
yexuejc.autoconfigure.redis.enable=true
|
||||
#webmvc 包含以下功能
|
||||
yexuejc.autoconfigure.webmvc.enable=true
|
||||
#全局异常处理
|
||||
yexuejc.ssl-ignore.enable=true
|
||||
#开启HTTPS(SSL)请求证书验证忽略
|
||||
yexuejc.global.exception.enable=true
|
||||
#开启校验过滤器,目前校验HTTP Header是否符合规范
|
||||
yexuejc.web.validation-filter.enable=true
|
||||
# 拦截类型(请求路径):0忽略模式,默认拦截全部;1拦截模式,默认一个都不拦截
|
||||
#yexuejc.http.filter=0
|
||||
yexuejc.http.filter.type=1
|
||||
#忽略路径:示例放开swagger
|
||||
#yexuejc.http.filter.ignored=/,/swagger/**,/error,/v2/api-docs,/webjars/**
|
||||
#========================================================================================================================
|
||||
#========================================================================================================================
|
||||
|
||||
|
||||
yexuejc.http.encrypt.encrypt=true
|
||||
yexuejc.http.encrypt.decrypt=true
|
||||
#<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD>ʽ
|
||||
#配置密钥方式
|
||||
#yexuejc.http.encrypt.private-key=MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAiSo5blJ9-QJ0_QElcy5AaRTq-3oO4lJ8PvIOIt-Xr5SUFODVj3DUbiy6_0bxQYO3NiYHlXPb37UVV3jjlXJsXwIDAQABAkBE0WOJH2hGs93gRl_0vwLf9ffDfkTTdlER_73p70aad3QZRslEkinQH7G5aE_DgBm5m72TCeH-PD2FZ2lwtavBAiEAvnRown5Lpqbl0tN_OUxr_e1u9d_-8dNL_JEETO7BZCECIQC4XtY-18j0bVVLxaXPjKQ00D59yntwObihDNyRK0nAfwIgHPHEGgrnpGQo-Wl7JFIg925mNqfcLxRVsAS6CpcefQECIQCUsLdsmy6QIhTmNRJSXoSXq1KatE_05DhIekzwLs8eFQIgfMawMiu52ZxBI5_pZ7ancQZ6Dsxl45utFqJShzV1pio
|
||||
#yexuejc.http.encrypt.public-key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIkqOW5SffkCdP0BJXMuQGkU6vt6DuJSfD7yDiLfl6-UlBTg1Y9w1G4suv9G8UGDtzYmB5Vz29-1FVd445VybF8CAwEAAQ
|
||||
#<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>鷽ʽ
|
||||
#配置证书方式
|
||||
yexuejc.http.encrypt.private-key-path=/lgfishing.keystore
|
||||
yexuejc.http.encrypt.private-alias=lgfishing
|
||||
yexuejc.http.encrypt.private-pwd=lgfishing2018
|
||||
|
||||
|
||||
#<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#编码
|
||||
spring.http.encoding.force=true
|
||||
spring.http.encoding.charset=UTF-8
|
||||
spring.http.encoding.enabled=true
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
|
||||
#<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HTTPS<EFBFBD><EFBFBD>SSL<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>Ĭ<EFBFBD><EFBFBD>false
|
||||
#是否开启HTTPS(SSL)请求证书验证忽略:默认false
|
||||
yexuejc.enable.ssl-ignore=true
|
||||
|
||||
|
||||
@@ -48,9 +66,9 @@ yexuejc.alibaba.oss.bucket=guansichou
|
||||
|
||||
|
||||
#========================================================================================================================
|
||||
# security<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
# security相关
|
||||
#reids
|
||||
#<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>redis<EFBFBD><EFBFBD>db0Ĭ<EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD>
|
||||
#开启指定redis库db0默认开启
|
||||
yexuejc.redis.db1=true
|
||||
spring.redis.jedis.pool.max-active=100
|
||||
spring.redis.jedis.pool.max-idle=10
|
||||
@@ -75,19 +93,19 @@ spring.datasource.data=classpath:db/data.sql
|
||||
#========================================================================================================================
|
||||
#mybatis-plus
|
||||
mybatis-plus.mapper-locations=classpath*:mapper/*.xml
|
||||
#ʵ<EFBFBD><EFBFBD>ɨ<EFBFBD>裬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>package<EFBFBD>ö<EFBFBD><EFBFBD>Ż<EFBFBD><EFBFBD>߷ֺŷָ<EFBFBD>
|
||||
#实体扫描,多个package用逗号或者分号分隔
|
||||
mybatis-plus.type-aliases-package=com.yexuejc.springboot.base.security.domain
|
||||
#<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0:"<22><><EFBFBD>ݿ<EFBFBD>ID<49><44><EFBFBD><EFBFBD>", 1:"<22>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ID",2:"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊδ<CEAA><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 3:"ȫ<EFBFBD><EFBFBD>ΨһID UUID",4:ȫ<EFBFBD><EFBFBD>ΨһID (UUID),5:<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>ΨһID (idWorker <EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ);
|
||||
#主键类型0:"数据库ID自增", 1:"用户输入ID",2:"该类型为未设置主键类型", 3:"全局唯一ID UUID",4:全局唯一ID (UUID),5:字符串全局唯一ID (idWorker 的字符串表示);
|
||||
mybatis-plus.global-config.db-config.id-type=uuid
|
||||
mybatis-plus.global-config.db-config.db-type=POSTGRE_SQL
|
||||
#<EFBFBD>ֶβ<EFBFBD><EFBFBD><EFBFBD> 0:"<22><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>",1:"<EFBFBD><EFBFBD> NULL <EFBFBD>ж<EFBFBD>"),2:"<EFBFBD>ǿ<EFBFBD><EFBFBD>ж<EFBFBD>"
|
||||
#字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
|
||||
mybatis-plus.global-config.db-config.field-strategy=not_empty
|
||||
#<EFBFBD>շ<EFBFBD><EFBFBD>»<EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>
|
||||
#驼峰下划线转换
|
||||
mybatis-plus.global-config.db-config.column-underline=true
|
||||
#<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
|
||||
#逻辑删除配置(下面3个配置)
|
||||
mybatis-plus.global-config.db-config.logic-delete-value=true
|
||||
mybatis-plus.global-config.db-config.logic-not-delete-value=false
|
||||
#<EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>(column<6D>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>&&<26><><EFBFBD><EFBFBD>javaʵ<61><CAB5><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD>)<29><><EFBFBD>Զ<EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>as<61><73>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C>Ҫдas<61><73> select user_id as userId<EFBFBD><EFBFBD>
|
||||
#配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId)
|
||||
mybatis-plus.configuration.map-underscore-to-camel-case=true
|
||||
mybatis-plus.configuration.cache-enabled=false
|
||||
#========================================================================================================================
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<groupId>com.yexuejc.springboot</groupId>
|
||||
<artifactId>yexuejc-springboot-parent</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<yexuejc.base.version>1.3.9</yexuejc.base.version>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.yexuejc.springboot</groupId>
|
||||
<artifactId>yexuejc-springboot-parent</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
<groupId>top.yexuejc</groupId>
|
||||
<artifactId>yexuejc-springboot-simple</artifactId>
|
||||
@@ -21,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>com.yexuejc.springboot</groupId>
|
||||
<artifactId>yexuejc-springboot-base</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>${parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
Reference in New Issue
Block a user