SGF-508 - Fixup and polish Redis Server Java configuration meta-data using @Enable annotations.
This commit is contained in:
@@ -50,13 +50,13 @@ public @interface EnableRedisServer {
|
||||
*
|
||||
* Defaults to {@literal localhost}.
|
||||
*/
|
||||
String bindAddress() default "localhost";
|
||||
String bindAddress() default "";
|
||||
|
||||
/**
|
||||
* Configures the Network port on which the Redis server will listen for Redis client connections.
|
||||
*
|
||||
* Defaults to {@literal 6379}.
|
||||
*/
|
||||
int port() default 6379;
|
||||
int port() default RedisServerConfiguration.DEFAULT_REDIS_PORT;
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.data.gemfire.config.annotation.support.EmbeddedServiceConfigurationSupport;
|
||||
import org.springframework.data.gemfire.util.PropertiesBuilder;
|
||||
|
||||
/**
|
||||
* The RedisServerConfiguration class is a Spring {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar}
|
||||
@@ -28,11 +29,14 @@ import org.springframework.data.gemfire.config.annotation.support.EmbeddedServic
|
||||
* an embedded Redis server.
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.data.gemfire.config.annotation.EnableRedisServer
|
||||
* @see org.springframework.data.gemfire.config.annotation.support.EmbeddedServiceConfigurationSupport
|
||||
* @since 1.9.0
|
||||
*/
|
||||
public class RedisServerConfiguration extends EmbeddedServiceConfigurationSupport {
|
||||
|
||||
protected static final int DEFAULT_REDIS_PORT = 6379;
|
||||
|
||||
@Override
|
||||
protected Class getAnnotationType() {
|
||||
return EnableRedisServer.class;
|
||||
@@ -40,11 +44,9 @@ public class RedisServerConfiguration extends EmbeddedServiceConfigurationSuppor
|
||||
|
||||
@Override
|
||||
protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) {
|
||||
Properties gemfireProperties = new Properties();
|
||||
|
||||
setProperty(gemfireProperties, "redis-bind-address", annotationAttributes.get("bindAddress"));
|
||||
setProperty(gemfireProperties, "redis-port", annotationAttributes.get("port"));
|
||||
|
||||
return gemfireProperties;
|
||||
return new PropertiesBuilder()
|
||||
.setProperty("redis-bind-address", annotationAttributes.get("bindAddress"))
|
||||
.setProperty("redis-port", resolvePort((Integer)annotationAttributes.get("port"), DEFAULT_REDIS_PORT))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user