Search in sources :

Example 1 with Cloud

use of org.springframework.cloud.Cloud in project pivotal-cla by pivotalsoftware.

the class SessionConfig method cloudRedisConnectionFactory.

@Profile(GitHubClaProfiles.CLOUDFOUNDRY)
@Bean
public RedisConnectionFactory cloudRedisConnectionFactory() {
    CloudFactory cloudFactory = new CloudFactory();
    Cloud cloud = cloudFactory.getCloud();
    RedisConnectionFactory connectionFactory = cloud.getSingletonServiceConnector(RedisConnectionFactory.class, null);
    if (connectionFactory instanceof LettuceConnectionFactory) {
        ((LettuceConnectionFactory) connectionFactory).setShutdownTimeout(0);
    }
    return connectionFactory;
}
Also used : CloudFactory(org.springframework.cloud.CloudFactory) Cloud(org.springframework.cloud.Cloud) LettuceConnectionFactory(org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory) RedisConnectionFactory(org.springframework.data.redis.connection.RedisConnectionFactory) Profile(org.springframework.context.annotation.Profile) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Cloud (org.springframework.cloud.Cloud)1 CloudFactory (org.springframework.cloud.CloudFactory)1 Bean (org.springframework.context.annotation.Bean)1 Profile (org.springframework.context.annotation.Profile)1 RedisConnectionFactory (org.springframework.data.redis.connection.RedisConnectionFactory)1 LettuceConnectionFactory (org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory)1