Example usage for org.springframework.beans.factory ObjectProvider getObject

List of usage examples for org.springframework.beans.factory ObjectProvider getObject

Introduction

In this page you can find the example usage for org.springframework.beans.factory ObjectProvider getObject.

Prototype

T getObject() throws BeansException;

Source Link

Document

Return an instance (possibly shared or independent) of the object managed by this factory.

Usage

From source file:org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration.java

@Autowired
public void setRedisConnectionFactory(
        @SpringSessionRedisConnectionFactory ObjectProvider<RedisConnectionFactory> springSessionRedisConnectionFactory,
        ObjectProvider<RedisConnectionFactory> redisConnectionFactory) {
    RedisConnectionFactory redisConnectionFactoryToUse = springSessionRedisConnectionFactory.getIfAvailable();
    if (redisConnectionFactoryToUse == null) {
        redisConnectionFactoryToUse = redisConnectionFactory.getObject();
    }/*  ww w  . ja v a2 s . co  m*/
    this.redisConnectionFactory = redisConnectionFactoryToUse;
}