Commit c78812d4 by 陈文顺

redisson

parent d848b58f
......@@ -24,8 +24,21 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-data-21</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<!-- for Spring Data Redis v.1.8.x -->
<artifactId>redisson-spring-data-18</artifactId>
<version>3.10.4</version>
</dependency>
<dependency>
......
package com.freemud.demo.util;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
......@@ -16,6 +17,9 @@ public abstract class RedisCache<T> {
@Autowired
protected RedisTemplate redisTemplate;
@Autowired
protected RedissonClient redissonClient;
private Class<T> clazz;
public RedisCache() {
......
......@@ -30,6 +30,7 @@
<spring-cloud.version>Edgware.SR2</spring-cloud.version>
<mybatis3.version>1.3.2</mybatis3.version>
<mapper.version>1.1.1</mapper.version>
<elasticSearch.version>3.1.5.RELEASE</elasticSearch.version>
</properties>
......@@ -46,6 +47,19 @@
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>${elasticSearch.version}</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.10.4</version>
</dependency>
</dependencies>
</dependencyManagement>
......
......@@ -69,6 +69,11 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.data</groupId>-->
<!--<artifactId>spring-data-elasticsearch</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
......@@ -78,10 +83,10 @@
<!--<groupId>org.springframework.cloud</groupId>-->
<!--<artifactId>spring-cloud-starter-eureka</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-actuator</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.cloud</groupId>-->
<!--<artifactId>spring-cloud-starter-feign</artifactId>-->
......@@ -138,6 +143,8 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
......
......@@ -3,16 +3,22 @@ package com.freemud.springbootdemo.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.Resource;
import javax.sql.DataSource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by chenwenshun on 2018/8/31.
......@@ -29,6 +35,14 @@ public class DataSourceConfig {
.build();
}
// @Bean
// public DataSource dataSource2(@Value("classpath:/application.yml") Resource configFile) throws IOException{
// String result = new BufferedReader(new InputStreamReader(configFile.getInputStream()))
// .lines().collect(Collectors.joining(System.lineSeparator()));
//
// return null;
// }
......
spring:
application:
name: dictionary
redis:
# host: 10.20.10.212
host: 115.159.67.166
port: 5289
password: U252fnIDyfF1A1
database: 3
datasource:
initialize: false
server:
port: 9005
datasource:
druid:
url: jdbc:mysql://10.30.30.14:6630/dict?useUnicode=true&characterEncoding=utf8
driver-class: com.mysql.jdbc.Driver
username: yanfa
password: yqKjKHX.1:bv
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
filters: stat
datasource2:
druid:
url: jdbc:mysql://111.231.82.13:6630/dict2?useUnicode=true&characterEncoding=utf8
driver-class: com.mysql.jdbc.Driver
username: yanfa
password: yqKjKHX.1:bv
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
filters: stat
#mybatis
mybatis:
config-location: classpath:mybatis.xml
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.freemud.demo.model
#dao
mapper:
mappers: com.freemud.demo.util.MyMapper
not-empty: false
identity: MYSQL
# before: true
#pagehelper
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
params: count=countSql
#log
logging:
config: classpath:logback.xml
#security:
# user:
# name: admin
# password: admin
# ignored: /**,/swagger*,/webjars/**,/v2/**,/swagger-resources/**
swagger_enable: true
#eureka:
# client:
# service-url:
# defaultZone: http://localhost:10001/eureka
#apollo:
# bootstrap:
# enabled: true
# meta: http://localhost:8080
#apollo appId
#app:
# id: order_service
......@@ -2,6 +2,7 @@ spring:
application:
name: dictionary
redis:
# host: 10.20.10.212
host: 115.159.67.166
port: 5289
password: U252fnIDyfF1A1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment