Skip to content
This repository was archived by the owner on May 19, 2022. It is now read-only.

Commit e78b80b

Browse files
committedOct 27, 2020
upgraded to lettusearch 2.4.4
1 parent 6b38988 commit e78b80b

File tree

2 files changed

+54
-48
lines changed

2 files changed

+54
-48
lines changed
 

‎build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
plugins {
22
id 'java'
3+
id 'distribution'
34
id 'java-library'
5+
id 'java-library-distribution'
46
id 'maven-publish'
5-
id 'com.github.ben-manes.versions' version '0.33.0'
67
id 'com.jfrog.bintray' version '1.8.5'
78
id 'net.researchgate.release' version '2.8.1'
9+
id 'com.github.ben-manes.versions' version '0.33.0'
810
id 'com.github.breadmoirai.github-release' version '2.2.12'
911
}
1012

@@ -19,8 +21,10 @@ repositories {
1921
}
2022

2123
dependencies {
22-
implementation 'org.springframework.boot:spring-boot-starter:2.3.4.RELEASE'
23-
api 'com.redislabs:lettusearch:2.4.3'
24+
implementation ('org.springframework.boot:spring-boot-starter:2.3.4.RELEASE') {
25+
exclude group: 'io.lettuce', module: 'lettuce-core'
26+
}
27+
api 'com.redislabs:lettusearch:2.4.4'
2428
api 'org.apache.commons:commons-pool2:2.9.0'
2529
compileOnly 'org.projectlombok:lombok:1.18.16'
2630
annotationProcessor 'org.projectlombok:lombok:1.18.16'

‎src/main/java/com/redislabs/springredisearch/RediSearchAutoConfiguration.java

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,56 +20,58 @@
2020
@EnableConfigurationProperties(RedisProperties.class)
2121
public class RediSearchAutoConfiguration {
2222

23-
@Bean
24-
RedisURI redisURI(RedisProperties properties) {
25-
RedisURI redisURI = RedisURI.create(properties.getHost(), properties.getPort());
26-
if (properties.getPassword() != null) {
27-
redisURI.setPassword(properties.getPassword());
28-
}
29-
Duration timeout = properties.getTimeout();
30-
if (timeout != null) {
31-
redisURI.setTimeout(timeout);
32-
}
33-
return redisURI;
34-
}
23+
@Bean
24+
RedisURI redisURI(RedisProperties properties) {
25+
RedisURI redisURI = RedisURI.create(properties.getHost(), properties.getPort());
26+
if (properties.getPassword() != null) {
27+
redisURI.setPassword(properties.getPassword().toCharArray());
28+
}
29+
Duration timeout = properties.getTimeout();
30+
if (timeout != null) {
31+
redisURI.setTimeout(timeout);
32+
}
33+
return redisURI;
34+
}
3535

36-
@Bean(destroyMethod = "shutdown")
37-
ClientResources clientResources() {
38-
return DefaultClientResources.create();
39-
}
36+
@Bean(destroyMethod = "shutdown")
37+
ClientResources clientResources() {
38+
return DefaultClientResources.create();
39+
}
4040

41-
@Bean(destroyMethod = "shutdown")
42-
RediSearchClient client(RedisURI redisURI, ClientResources clientResources) {
43-
return RediSearchClient.create(clientResources, redisURI);
44-
}
41+
@Bean(destroyMethod = "shutdown")
42+
RediSearchClient client(RedisURI redisURI, ClientResources clientResources) {
43+
return RediSearchClient.create(clientResources, redisURI);
44+
}
4545

46-
@Bean(name = "rediSearchConnection", destroyMethod = "close")
47-
StatefulRediSearchConnection<String, String> connection(RediSearchClient rediSearchClient) {
48-
return rediSearchClient.connect();
49-
}
46+
@Bean(name = "rediSearchConnection", destroyMethod = "close")
47+
StatefulRediSearchConnection<String, String> connection(RediSearchClient rediSearchClient) {
48+
return rediSearchClient.connect();
49+
}
5050

51-
@Bean(name = "rediSearchConnectionPoolConfig")
52-
GenericObjectPoolConfig<StatefulRediSearchConnection<String, String>> poolConfig(RedisProperties redisProperties) {
53-
return configure(redisProperties, new GenericObjectPoolConfig<>());
54-
}
51+
@Bean(name = "rediSearchConnectionPoolConfig")
52+
GenericObjectPoolConfig<StatefulRediSearchConnection<String, String>> poolConfig(RedisProperties redisProperties) {
53+
return configure(redisProperties, new GenericObjectPoolConfig<>());
54+
}
5555

56-
public <K, V> GenericObjectPoolConfig<StatefulRediSearchConnection<K, V>> configure(RedisProperties redisProperties, GenericObjectPoolConfig<StatefulRediSearchConnection<K, V>> config) {
57-
config.setJmxEnabled(false);
58-
Pool poolProps = redisProperties.getLettuce().getPool();
59-
if (poolProps != null) {
60-
config.setMaxTotal(poolProps.getMaxActive());
61-
config.setMaxIdle(poolProps.getMaxIdle());
62-
config.setMinIdle(poolProps.getMinIdle());
63-
if (poolProps.getMaxWait() != null) {
64-
config.setMaxWaitMillis(poolProps.getMaxWait().toMillis());
65-
}
66-
}
67-
return config;
68-
}
56+
public <K, V> GenericObjectPoolConfig<StatefulRediSearchConnection<K, V>> configure(RedisProperties redisProperties,
57+
GenericObjectPoolConfig<StatefulRediSearchConnection<K, V>> config) {
58+
config.setJmxEnabled(false);
59+
Pool poolProps = redisProperties.getLettuce().getPool();
60+
if (poolProps != null) {
61+
config.setMaxTotal(poolProps.getMaxActive());
62+
config.setMaxIdle(poolProps.getMaxIdle());
63+
config.setMinIdle(poolProps.getMinIdle());
64+
if (poolProps.getMaxWait() != null) {
65+
config.setMaxWaitMillis(poolProps.getMaxWait().toMillis());
66+
}
67+
}
68+
return config;
69+
}
6970

70-
@Bean(name = "rediSearchConnectionPool", destroyMethod = "close")
71-
GenericObjectPool<StatefulRediSearchConnection<String, String>> pool(GenericObjectPoolConfig<StatefulRediSearchConnection<String, String>> config, RediSearchClient client) {
72-
return ConnectionPoolSupport.createGenericObjectPool(client::connect, config);
73-
}
71+
@Bean(name = "rediSearchConnectionPool", destroyMethod = "close")
72+
GenericObjectPool<StatefulRediSearchConnection<String, String>> pool(
73+
GenericObjectPoolConfig<StatefulRediSearchConnection<String, String>> config, RediSearchClient client) {
74+
return ConnectionPoolSupport.createGenericObjectPool(client::connect, config);
75+
}
7476

7577
}

0 commit comments

Comments
 (0)
This repository has been archived.