├── pom.xml
└── src
├── main
├── java
│ └── com
│ │ └── example
│ │ └── demo
│ │ ├── ShardingJavaDemoApplication.java
│ │ ├── common
│ │ ├── base
│ │ │ ├── BaseRest.java
│ │ │ ├── CodeEnumInterface.java
│ │ │ └── Result.java
│ │ └── utils
│ │ │ └── UUIDUtil.java
│ │ ├── config
│ │ ├── datasource
│ │ │ └── DataSourceProperties.java
│ │ ├── druidConfig
│ │ │ └── DruidAutoConfiguration.java
│ │ ├── mybatisplus
│ │ │ └── MybatisPlusConfig.java
│ │ ├── redis
│ │ │ ├── RedisConfig.java
│ │ │ ├── RedisPrefixEnum.java
│ │ │ └── RedisService.java
│ │ └── shardingconfig
│ │ │ ├── CarParkShardingTableAlgorithm.java
│ │ │ ├── DatasourceEnum.java
│ │ │ ├── LocalRegistryCenter.java
│ │ │ ├── ShardingRuleConfig.java
│ │ │ ├── ShardingService.java
│ │ │ └── ShardingTableEnum.java
│ │ ├── dao
│ │ ├── CarParkMapper.java
│ │ ├── OrderMapper.java
│ │ └── OrderMapper.xml
│ │ ├── pojo
│ │ ├── CarPark.java
│ │ └── Order.java
│ │ ├── rest
│ │ ├── CarParkRest.java
│ │ └── OrderRest.java
│ │ └── service
│ │ ├── CarParkService.java
│ │ ├── OrderService.java
│ │ └── impl
│ │ ├── CarParkServiceImpl.java
│ │ └── OrderServiceImpl.java
└── resources
│ ├── META-INF
│ └── services
│ │ └── org.apache.shardingsphere.orchestration.reg.api.RegistryCenter
│ └── application.yml
└── test
└── java
└── com
└── example
└── demo
└── ShardingJavaDemoApplicationTests.java
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.2.6.RELEASE
9 |
10 |
11 | com.example
12 | demo
13 | 0.0.1-SNAPSHOT
14 | shardingJavaDemo
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-test
30 | test
31 |
32 |
33 | org.junit.vintage
34 | junit-vintage-engine
35 |
36 |
37 |
38 |
39 |
40 | org.springframework.boot
41 | spring-boot-starter-data-redis
42 |
43 |
44 |
45 |
46 | com.baomidou
47 | mybatis-plus-boot-starter
48 | 3.3.1.tmp
49 |
50 |
51 |
52 |
53 | org.projectlombok
54 | lombok
55 | provided
56 |
57 |
58 |
59 |
60 | com.alibaba
61 | fastjson
62 | 1.2.60
63 |
64 |
65 |
66 |
67 | mysql
68 | mysql-connector-java
69 | 5.1.44
70 |
71 |
72 |
73 |
74 | com.alibaba
75 | druid
76 | 1.1.20
77 |
78 |
79 |
80 | org.springframework.boot
81 | spring-boot-starter-log4j2
82 |
83 |
84 |
85 | org.apache.shardingsphere
86 | sharding-jdbc-core
87 | 4.0.0
88 |
89 |
90 |
91 | org.apache.shardingsphere
92 | sharding-jdbc-orchestration
93 | 4.0.0
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | org.springframework.boot
102 | spring-boot-maven-plugin
103 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/ShardingJavaDemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
6 | import org.springframework.boot.autoconfigure.SpringBootApplication;
7 | import org.springframework.context.annotation.ComponentScan;
8 |
9 | @SpringBootApplication
10 | @MapperScan(basePackages = {"com.example.demo.dao"})
11 | @EnableAutoConfiguration
12 | @ComponentScan(value = {"com.example.demo.config.**","com.example"})
13 | public class ShardingJavaDemoApplication {
14 |
15 | public static void main(String[] args) {
16 | SpringApplication.run(ShardingJavaDemoApplication.class, args);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/common/base/BaseRest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Source code recreated from a .class file by IntelliJ IDEA
3 | // (powered by Fernflower decompiler)
4 | //
5 |
6 | package com.example.demo.common.base;
7 |
8 | import com.example.demo.common.base.CodeEnumInterface.CodeEnumEnum;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 |
11 | import javax.servlet.http.HttpServletRequest;
12 | import java.util.*;
13 |
14 | public class BaseRest {
15 | @Autowired
16 | protected HttpServletRequest request;
17 | private static final String ERROR_MESSAGE = "操作失败";
18 | public static final String SUCCESS_MESSAGE = "操作成功";
19 |
20 | public BaseRest() {
21 | }
22 |
23 | public Result addSucResult() {
24 | return this.addResult(true, CodeEnumEnum.SUCCESS.getValue(), "操作成功", (Object)null);
25 | }
26 |
27 | public Result addSucResult(T object) {
28 | if (!(object instanceof List) && !(object instanceof Set) && !(object instanceof LinkedList)) {
29 | return this.addResult(true, CodeEnumEnum.SUCCESS.getValue(), "操作成功", object);
30 | } else {
31 | Map map = new HashMap();
32 | map.put("list", object);
33 | return this.addResult(true, CodeEnumEnum.SUCCESS.getValue(), "操作成功", map);
34 | }
35 | }
36 |
37 | public Result addSucResult(String message, T object) {
38 | if (!(object instanceof List) && !(object instanceof Set) && !(object instanceof LinkedList)) {
39 | return this.addResult(true, CodeEnumEnum.SUCCESS.getValue(), message, object);
40 | } else {
41 | Map map = new HashMap();
42 | map.put("list", object);
43 | return this.addResult(true, CodeEnumEnum.SUCCESS.getValue(), message, map);
44 | }
45 | }
46 |
47 | public Result addSucResult(String code, String message, T object) {
48 | if (!(object instanceof List) && !(object instanceof Set) && !(object instanceof LinkedList)) {
49 | return this.addResult(true, code, message, object);
50 | } else {
51 | Map map = new HashMap();
52 | map.put("list", object);
53 | return this.addResult(true, code, message, map);
54 | }
55 | }
56 |
57 | public Result addSucResult(String message) {
58 | return this.addResult(true, CodeEnumEnum.SUCCESS.getValue(), message, (Object)null);
59 | }
60 |
61 | public Result addErrResult() {
62 | return this.addResult(false, CodeEnumEnum.ERROR.getValue(), "操作失败", (Object)null);
63 | }
64 |
65 | public Result addErrResult(String errMsg) {
66 | return this.addResult(false, CodeEnumEnum.ERROR.getValue(), errMsg, (Object)null);
67 | }
68 |
69 | public Result addErrResult(String code, String errMsg) {
70 | return this.addResult(false, code, errMsg, (Object)null);
71 | }
72 |
73 | public Result addResult(boolean result, String code, String message, T data) {
74 | Result rs = new Result();
75 | rs.setResult(result);
76 | rs.setCode(code);
77 | rs.setMessage(message);
78 | rs.setData(data);
79 | return rs;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/common/base/CodeEnumInterface.java:
--------------------------------------------------------------------------------
1 | //
2 | // Source code recreated from a .class file by IntelliJ IDEA
3 | // (powered by Fernflower decompiler)
4 | //
5 |
6 | package com.example.demo.common.base;
7 |
8 | public interface CodeEnumInterface {
9 | public static enum CodeEnumEnum implements CodeEnumInterface {
10 | SUCCESS("200", "操作成功."),
11 | LOGIN_WITHOUT("401", "未登录."),
12 | LOGIN_TIMEOUT("40101", "登录超时."),
13 | LOGIN_CONFLICT("40102", "登录冲突."),
14 | PERMISSION_WITHOUT("403", "无权限."),
15 | ERROR("500", "系统未知错误."),
16 | ERROR_INPUT_CHECK("500001", "参数验证错误."),
17 | ERROR_USER_INSERT("5001001", "用户新增异常"),
18 | ERROR_USER_UPDATE("5001002", "用户更新异常"),
19 | ERROR_USER_DELETE("5001003", "用户删除异常"),
20 | ERROR_USER_EXPECTED("5001004", "用户数据不符合预期"),
21 | ERROR_USER_SELECT("5001005", "用户数据未找到"),
22 | ERROR_ROLE_INSERT("5002001", "角色新增异常"),
23 | ERROR_ROLE_UPDATE("5002002", "角色更新异常"),
24 | ERROR_ROLE_DELETE("5002003", "角色删除异常"),
25 | ERROR_ROLE_EXPECTED("5002004", "角色数据不符合预期"),
26 | ERROR_ROLE_SELECT("5002005", "角色数据未找到"),
27 | ERROR_ORG_INSERT("5003001", "组织机构新增异常"),
28 | ERROR_ORG_UPDATE("5003002", "组织机构更新异常"),
29 | ERROR_ORG_DELETE("5003003", "组织机构删除异常"),
30 | ERROR_ORG_EXPECTED("5003004", "组织机构数据不符合预期"),
31 | ERROR_ORG_SELECT("5003005", "组织机构数据未找到"),
32 | ERROR_DIC_INSERT("5004001", "字典新增异常"),
33 | ERROR_DIC_UPDATE("5004002", "字典更新异常"),
34 | ERROR_DIC_DELETE("5004003", "字典删除异常"),
35 | ERROR_DIC_EXPECTED("5004004", "字典数据不符合预期"),
36 | ERROR_DIC_SELECT("5004005", "字典数据未找到");
37 |
38 | private final String value;
39 | private final String label;
40 |
41 | private CodeEnumEnum(String value, String label) {
42 | this.value = value;
43 | this.label = label;
44 | }
45 |
46 | public String getValue() {
47 | return this.value;
48 | }
49 |
50 | public String getLabel() {
51 | return this.label;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/common/base/Result.java:
--------------------------------------------------------------------------------
1 | //
2 | // Source code recreated from a .class file by IntelliJ IDEA
3 | // (powered by Fernflower decompiler)
4 | //
5 |
6 | package com.example.demo.common.base;
7 |
8 | import java.io.Serializable;
9 |
10 | public class Result implements Serializable {
11 | public static final String SUCCESS_MSG = "操作成功!";
12 | private static final long serialVersionUID = -34684491868853686L;
13 | private boolean result;
14 | private String code;
15 | private String message;
16 | private String token;
17 | private Long count;
18 | private T data;
19 |
20 | public Result() {
21 | }
22 |
23 | public boolean isResult() {
24 | return this.result;
25 | }
26 |
27 | public void setResult(boolean result) {
28 | this.result = result;
29 | }
30 |
31 | public String getCode() {
32 | return this.code;
33 | }
34 |
35 | public void setCode(String code) {
36 | this.code = code;
37 | }
38 |
39 | public String getMessage() {
40 | return this.message;
41 | }
42 |
43 | public void setMessage(String message) {
44 | this.message = message;
45 | }
46 |
47 | public String getToken() {
48 | return this.token;
49 | }
50 |
51 | public void setToken(String token) {
52 | this.token = token;
53 | }
54 |
55 | public Long getCount() {
56 | return this.count;
57 | }
58 |
59 | public void setCount(Long count) {
60 | this.count = count;
61 | }
62 |
63 | public T getData() {
64 | return this.data;
65 | }
66 |
67 | public void setData(T data) {
68 | this.data = data;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/common/utils/UUIDUtil.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.common.utils;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * @title: UUIDUtil
7 | * @projectName ips-parent
8 | * @description: uuid工具类
9 | * @author zhy
10 | * @date 2020/3/412:17
11 | */
12 | public class UUIDUtil {
13 |
14 | private UUIDUtil(){}
15 |
16 | /**
17 | * @description: 获取uuid
18 | * @throws
19 | * @return
20 | * @author zhy
21 | * @date 2020/3/4 12:18
22 | */
23 | public static String getUUID(){
24 | UUID uuid = UUID.randomUUID();
25 | return uuid.toString().replaceAll("\\-", "");
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/config/datasource/DataSourceProperties.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.config.datasource;
2 |
3 | import org.springframework.boot.context.properties.ConfigurationProperties;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | @Configuration
7 | @ConfigurationProperties(prefix = "spring.druid.datasource")
8 | public class DataSourceProperties {
9 | private String type;
10 | private String driverClassName;
11 | private String url;
12 | private String username;
13 | private String password;
14 |
15 | private Integer initialSize;
16 | private Integer minIdle;
17 | private Integer maxActive;
18 | private Long maxWait;
19 | private Long timeBetweenEvictionRunsMillis;
20 | private Long minEvictableIdleTimeMillis;
21 | private String validationQuery;
22 | private boolean testWhileIdle;
23 | private boolean testOnBorrow;
24 | private boolean testOnReturn;
25 | private boolean poolPreparedStatements;
26 | private Integer maxPoolPreparedStatementPerConnectionSize;
27 | private String filters;
28 | private String connectionProperties;
29 | private boolean useGlobalDataSourceStat;
30 | private String loginUsername;
31 | private String loginPassword;
32 |
33 | public String getType() {
34 | return type;
35 | }
36 |
37 | public void setType(String type) {
38 | this.type = type;
39 | }
40 |
41 | public String getDriverClassName() {
42 | return driverClassName;
43 | }
44 |
45 | public void setDriverClassName(String driverClassName) {
46 | this.driverClassName = driverClassName;
47 | }
48 |
49 | public String getUrl() {
50 | return url;
51 | }
52 |
53 | public void setUrl(String url) {
54 | this.url = url;
55 | }
56 |
57 | public String getUsername() {
58 | return username;
59 | }
60 |
61 | public void setUsername(String username) {
62 | this.username = username;
63 | }
64 |
65 | public String getPassword() {
66 | return password;
67 | }
68 |
69 | public void setPassword(String password) {
70 | this.password = password;
71 | }
72 |
73 | public Integer getInitialSize() {
74 | return initialSize;
75 | }
76 |
77 | public void setInitialSize(Integer initialSize) {
78 | this.initialSize = initialSize;
79 | }
80 |
81 | public Integer getMinIdle() {
82 | return minIdle;
83 | }
84 |
85 | public void setMinIdle(Integer minIdle) {
86 | this.minIdle = minIdle;
87 | }
88 |
89 | public Integer getMaxActive() {
90 | return maxActive;
91 | }
92 |
93 | public void setMaxActive(Integer maxActive) {
94 | this.maxActive = maxActive;
95 | }
96 |
97 | public Long getMaxWait() {
98 | return maxWait;
99 | }
100 |
101 | public void setMaxWait(Long maxWait) {
102 | this.maxWait = maxWait;
103 | }
104 |
105 | public Long getTimeBetweenEvictionRunsMillis() {
106 | return timeBetweenEvictionRunsMillis;
107 | }
108 |
109 | public void setTimeBetweenEvictionRunsMillis(Long timeBetweenEvictionRunsMillis) {
110 | this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
111 | }
112 |
113 | public Long getMinEvictableIdleTimeMillis() {
114 | return minEvictableIdleTimeMillis;
115 | }
116 |
117 | public void setMinEvictableIdleTimeMillis(Long minEvictableIdleTimeMillis) {
118 | this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
119 | }
120 |
121 | public String getValidationQuery() {
122 | return validationQuery;
123 | }
124 |
125 | public void setValidationQuery(String validationQuery) {
126 | this.validationQuery = validationQuery;
127 | }
128 |
129 | public boolean isTestWhileIdle() {
130 | return testWhileIdle;
131 | }
132 |
133 | public void setTestWhileIdle(boolean testWhileIdle) {
134 | this.testWhileIdle = testWhileIdle;
135 | }
136 |
137 | public boolean isTestOnBorrow() {
138 | return testOnBorrow;
139 | }
140 |
141 | public void setTestOnBorrow(boolean testOnBorrow) {
142 | this.testOnBorrow = testOnBorrow;
143 | }
144 |
145 | public boolean isTestOnReturn() {
146 | return testOnReturn;
147 | }
148 |
149 | public void setTestOnReturn(boolean testOnReturn) {
150 | this.testOnReturn = testOnReturn;
151 | }
152 |
153 | public boolean isPoolPreparedStatements() {
154 | return poolPreparedStatements;
155 | }
156 |
157 | public void setPoolPreparedStatements(boolean poolPreparedStatements) {
158 | this.poolPreparedStatements = poolPreparedStatements;
159 | }
160 |
161 | public Integer getMaxPoolPreparedStatementPerConnectionSize() {
162 | return maxPoolPreparedStatementPerConnectionSize;
163 | }
164 |
165 | public void setMaxPoolPreparedStatementPerConnectionSize(Integer maxPoolPreparedStatementPerConnectionSize) {
166 | this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize;
167 | }
168 |
169 | public String getFilters() {
170 | return filters;
171 | }
172 |
173 | public void setFilters(String filters) {
174 | this.filters = filters;
175 | }
176 |
177 | public String getConnectionProperties() {
178 | return connectionProperties;
179 | }
180 |
181 | public void setConnectionProperties(String connectionProperties) {
182 | this.connectionProperties = connectionProperties;
183 | }
184 |
185 | public boolean isUseGlobalDataSourceStat() {
186 | return useGlobalDataSourceStat;
187 | }
188 |
189 | public void setUseGlobalDataSourceStat(boolean useGlobalDataSourceStat) {
190 | this.useGlobalDataSourceStat = useGlobalDataSourceStat;
191 | }
192 |
193 | public String getLoginUsername() {
194 | return loginUsername;
195 | }
196 |
197 | public void setLoginUsername(String loginUsername) {
198 | this.loginUsername = loginUsername;
199 | }
200 |
201 | public String getLoginPassword() {
202 | return loginPassword;
203 | }
204 |
205 | public void setLoginPassword(String loginPassword) {
206 | this.loginPassword = loginPassword;
207 | }
208 | }
209 |
210 |
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/config/druidConfig/DruidAutoConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.config.druidConfig;
2 |
3 | import com.alibaba.druid.support.http.StatViewServlet;
4 | import com.alibaba.druid.support.http.WebStatFilter;
5 | import com.example.demo.config.datasource.DataSourceProperties;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.boot.web.servlet.FilterRegistrationBean;
8 | import org.springframework.boot.web.servlet.ServletRegistrationBean;
9 | import org.springframework.context.annotation.Bean;
10 | import org.springframework.context.annotation.Configuration;
11 |
12 | /**
13 | * Created by sjt on 2017/7/24.
14 | */
15 | @Configuration
16 | public class DruidAutoConfiguration {
17 |
18 | @Autowired
19 | private DataSourceProperties properties;
20 |
21 |
22 | /**
23 | * Druid的Servlet
24 | *
25 | * @return
26 | */
27 | @Bean
28 | public ServletRegistrationBean druidStatViewServlet() {
29 | ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
30 |
31 | /** 添加初始化参数:initParams */
32 | /** 白名单,如果不配置或value为空,则允许所有 */
33 | //servletRegistrationBean.addInitParameter("allow", "127.0.0.1,192.0.0.1");
34 | /** 黑名单,与白名单存在相同IP时,优先于白名单 */
35 | //servletRegistrationBean.addInitParameter("deny", "192.0.0.1");
36 | /** 用户名 */
37 | servletRegistrationBean.addInitParameter("loginUsername", properties.getLoginUsername());
38 | /** 密码 */
39 | servletRegistrationBean.addInitParameter("loginPassword", properties.getLoginPassword());
40 | /** 禁用页面上的“Reset All”功能 */
41 | servletRegistrationBean.addInitParameter("resetEnable", "false");
42 | return servletRegistrationBean;
43 | }
44 |
45 | /**
46 | * Druid拦截器,用于查看Druid监控
47 | *
48 | * @return
49 | */
50 | @Bean
51 | public FilterRegistrationBean druidStatFilter() {
52 | FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
53 | /** 过滤规则 */
54 | filterRegistrationBean.addUrlPatterns("/*");
55 | /** 忽略资源 */
56 | filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*");
57 | return filterRegistrationBean;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/config/mybatisplus/MybatisPlusConfig.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.config.mybatisplus;
2 |
3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.transaction.annotation.EnableTransactionManagement;
7 |
8 | @EnableTransactionManagement
9 | @Configuration
10 | public class MybatisPlusConfig {
11 |
12 | @Bean
13 | public PaginationInterceptor paginationInterceptor() {
14 | PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
15 | // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
16 | // paginationInterceptor.setOverflow(false);
17 | // 设置最大单页限制数量,默认 500 条,-1 不受限制
18 | paginationInterceptor.setLimit(-1);
19 | return paginationInterceptor;
20 | }
21 | }
--------------------------------------------------------------------------------
/src/main/java/com/example/demo/config/redis/RedisConfig.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.config.redis;
2 | import com.fasterxml.jackson.annotation.JsonAutoDetect;
3 | import com.fasterxml.jackson.annotation.PropertyAccessor;
4 | import com.fasterxml.jackson.databind.ObjectMapper;
5 | import org.springframework.cache.CacheManager;
6 | import org.springframework.cache.annotation.CachingConfigurerSupport;
7 | import org.springframework.cache.annotation.EnableCaching;
8 | import org.springframework.cache.interceptor.KeyGenerator;
9 | import org.springframework.cache.interceptor.SimpleKeyGenerator;
10 | import org.springframework.context.annotation.Bean;
11 | import org.springframework.context.annotation.Configuration;
12 | import org.springframework.data.redis.cache.RedisCacheConfiguration;
13 | import org.springframework.data.redis.cache.RedisCacheManager;
14 | import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
15 | import org.springframework.data.redis.core.RedisTemplate;
16 | import org.springframework.data.redis.core.StringRedisTemplate;
17 | import org.springframework.data.redis.serializer.*;
18 | import java.lang.reflect.Method;
19 | import java.time.Duration;
20 | import java.util.HashMap;
21 | import java.util.HashSet;
22 | import java.util.Map;
23 | import java.util.Set;
24 | /**
25 | *
26 | * @description: redis 缓存配置类
27 | * @create: 2018-05-02 15:14
28 | **/
29 | @Configuration
30 | @EnableCaching
31 | @SuppressWarnings({"rawtypes","unchecked"})
32 | public class RedisConfig extends CachingConfigurerSupport {
33 | /**
34 | * json序列化
35 | * @return
36 | */
37 | @Bean
38 | public RedisSerializer