/** * Get the {@link Cluster} object associated with the only Cassandra service bound to * the app. * * @return the Cassandra {@link Cluster} * @throws org.springframework.cloud.CloudException if there are either 0 or more than * 1 Cassandra database services. */ @Override public Cluster cluster() { return cluster((CassandraClusterConfig) null); }
/** * Get the {@link DataSource} object for the specified relational database service. * * This is equivalent to the <cloud:data-source service-id="serviceId"/> * * @param serviceId the name of the service * @return data source * @throws CloudException if the specified service doesn't exist */ public DataSource dataSource(String serviceId) { return dataSource(serviceId, null); }
/** * Get the service connector object associated with the only service bound to the app. * * This is equivalent to the <cloud:service/> element. * * @return service connector object * @throws CloudException if there are either 0 or more than 1 services. */ public Object service() { return service(Object.class); }
@Bean(name="my-service") public DataSource testDatasource() { return connectionFactory().dataSource(); } }
@Bean(name = "my-service") public RedisConnectionFactory testRedisConnectionFactory() { return connectionFactory().redisConnectionFactory("my-service"); } }
@Bean(name="my-service") public MongoDbFactory testMongoDbFactory() { return connectionFactory().mongoDbFactory("my-service"); } }
@Bean(name="my-service") public MongoDbFactory testMongoDbFactory() { return connectionFactory().mongoDbFactory(); } }
@Bean(name="my-service") public ConnectionFactory testRabbitConnectionFactory() { return connectionFactory().rabbitConnectionFactory(); } }
/** * Get the {@link DataSource} object associated with the only relational database service bound to the app. * * This is equivalent to the {@code <cloud:data-source/>} element. * * @return data source * @throws CloudException * if there are either 0 or more than 1 relational database services. */ @Override public DataSource dataSource() { return dataSource((DataSourceConfig) null); }
/** * Get the {@link MongoDbFactory} object associated with the only MongoDB service bound to the app. * * This is equivalent to the {@code <cloud:mongo-db-factory/>} element. * * @return mongo db factory * @throws CloudException * if there are either 0 or more than 1 mongodb services. */ @Override public MongoDbFactory mongoDbFactory() { return mongoDbFactory((MongoDbFactoryConfig) null); }
/** * Get the service connector object associated with the only service bound to the app. * * This is equivalent to the {@code <cloud:service/>} element. * * @return service connector object * @throws CloudException * if there are either 0 or more than 1 services. */ @Override public Object service() { return service(Object.class); }
/** * Get the {@link MongoDbFactory} object associated with the only MongoDB service bound to the app. * * This is equivalent to the <cloud:mongo-db-factory/> element. * * @return mongo db factory * @throws CloudException if there are either 0 or more than 1 mongodb services. */ public MongoDbFactory mongoDbFactory() { return mongoDbFactory((MongoDbFactoryConfig)null); }
/** * Get the {@link ConnectionFactory} object associated with the only RabbitMQ service bound to the app. * * This is equivalent to the <cloud:rabbit-connection-factory> element. * * @return rabbit connection factory * @throws CloudException if there are either 0 or more than 1 RabbitMQ services. */ public ConnectionFactory rabbitConnectionFactory() { return rabbitConnectionFactory((RabbitConnectionFactoryConfig)null); }
/** * Get the {@link RedisConnectionFactory} object associated with the only Redis service bound to the app. * * This is equivalent to the <cloud:redis-connection-factory/> element * * @return redis connection factory * @throws CloudException if there are either 0 or more than 1 redis services. */ public RedisConnectionFactory redisConnectionFactory() { return redisConnectionFactory((PooledServiceConnectorConfig)null); }
/** * Get the {@link Cluster} object associated with the only Cassandra service bound to * the app. * * @return the Cassandra {@link Cluster} * @throws org.springframework.cloud.CloudException if there are either 0 or more than * 1 Cassandra database services. */ @Override public Cluster cluster() { return cluster((CassandraClusterConfig) null); }
/** * Get the {@link DataSource} object associated with the only relational database service bound to the app. * * This is equivalent to the <cloud:data-source/> element. * * @return data source * @throws CloudException if there are either 0 or more than 1 relational database services. */ public DataSource dataSource() { return dataSource((DataSourceConfig)null); }
/** * Get the service connector object for the specified service. * * This is equivalent to the <cloud:service service-id="serviceId"/> element. * * @return service connector object * @throws CloudException if the specified service doesn't exist */ public Object service(String serviceId) { return service(serviceId, Object.class); }
/** * Get the {@link MongoDbFactory} object for the specified MongoDB service. * * This is equivalent to the <cloud:mongo-db-factory service-id="serviceId"> element. * * @param serviceId the name of the service * @return mongo db factory * @throws CloudException if the specified service doesn't exist */ public MongoDbFactory mongoDbFactory(String serviceId) { return mongoDbFactory(serviceId, null); }
/** * Get the {@link ConnectionFactory} object for the specified RabbitMQ service. * * This is equivalent to the <cloud:rabbit-connection-factory service-id="serviceId"> element. * * @param serviceId the name of the service * @return rabbit connection factory * @throws CloudException if the specified service doesn't exist */ public ConnectionFactory rabbitConnectionFactory(String serviceId) { return rabbitConnectionFactory(serviceId, null); }
/** * Get the {@link RedisConnectionFactory} object for the specified Redis service. * * This is equivalent to the <cloud:redis-connection-factory service-id="serviceId"> element. * * @param serviceId the name of the service * @return redis connection factory * @throws CloudException if the specified service doesn't exist */ public RedisConnectionFactory redisConnectionFactory(String serviceId) { return redisConnectionFactory(serviceId, null); }