Commit c78812d4 by 陈文顺

redisson

parent d848b58f
...@@ -24,8 +24,21 @@ ...@@ -24,8 +24,21 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.redisson</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <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>
<dependency> <dependency>
......
package com.freemud.demo.util; package com.freemud.demo.util;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -16,6 +17,9 @@ public abstract class RedisCache<T> { ...@@ -16,6 +17,9 @@ public abstract class RedisCache<T> {
@Autowired @Autowired
protected RedisTemplate redisTemplate; protected RedisTemplate redisTemplate;
@Autowired
protected RedissonClient redissonClient;
private Class<T> clazz; private Class<T> clazz;
public RedisCache() { public RedisCache() {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<spring-cloud.version>Edgware.SR2</spring-cloud.version> <spring-cloud.version>Edgware.SR2</spring-cloud.version>
<mybatis3.version>1.3.2</mybatis3.version> <mybatis3.version>1.3.2</mybatis3.version>
<mapper.version>1.1.1</mapper.version> <mapper.version>1.1.1</mapper.version>
<elasticSearch.version>3.1.5.RELEASE</elasticSearch.version>
</properties> </properties>
...@@ -46,6 +47,19 @@ ...@@ -46,6 +47,19 @@
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version> <version>2.7.0</version>
</dependency> </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> </dependencies>
</dependencyManagement> </dependencyManagement>
......
...@@ -69,6 +69,11 @@ ...@@ -69,6 +69,11 @@
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.data</groupId>-->
<!--<artifactId>spring-data-elasticsearch</artifactId>-->
<!--</dependency>-->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId> <artifactId>spring-cloud-starter-sleuth</artifactId>
...@@ -78,10 +83,10 @@ ...@@ -78,10 +83,10 @@
<!--<groupId>org.springframework.cloud</groupId>--> <!--<groupId>org.springframework.cloud</groupId>-->
<!--<artifactId>spring-cloud-starter-eureka</artifactId>--> <!--<artifactId>spring-cloud-starter-eureka</artifactId>-->
<!--</dependency>--> <!--</dependency>-->
<!--<dependency>--> <dependency>
<!--<groupId>org.springframework.boot</groupId>--> <groupId>org.springframework.boot</groupId>
<!--<artifactId>spring-boot-starter-actuator</artifactId>--> <artifactId>spring-boot-starter-actuator</artifactId>
<!--</dependency>--> </dependency>
<!--<dependency>--> <!--<dependency>-->
<!--<groupId>org.springframework.cloud</groupId>--> <!--<groupId>org.springframework.cloud</groupId>-->
<!--<artifactId>spring-cloud-starter-feign</artifactId>--> <!--<artifactId>spring-cloud-starter-feign</artifactId>-->
...@@ -138,6 +143,8 @@ ...@@ -138,6 +143,8 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -3,16 +3,22 @@ package com.freemud.springbootdemo.config; ...@@ -3,16 +3,22 @@ package com.freemud.springbootdemo.config;
import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; 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.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.core.io.Resource;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* Created by chenwenshun on 2018/8/31. * Created by chenwenshun on 2018/8/31.
...@@ -29,6 +35,14 @@ public class DataSourceConfig { ...@@ -29,6 +35,14 @@ public class DataSourceConfig {
.build(); .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: ...@@ -2,6 +2,7 @@ spring:
application: application:
name: dictionary name: dictionary
redis: redis:
# host: 10.20.10.212
host: 115.159.67.166 host: 115.159.67.166
port: 5289 port: 5289
password: U252fnIDyfF1A1 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