io.r2dbc.postgresql.PostgresqlConnectionConfiguration Java Examples

The following examples show how to use io.r2dbc.postgresql.PostgresqlConnectionConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PostgresqlDatabaseClientInitializer.java    From spring-fu with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(GenericApplicationContext context) {

	PostgresqlConnectionConfiguration configuration = PostgresqlConnectionConfiguration
			.builder()
			.host(this.properties.getHost())
			.port(this.properties.getPort())
			.database(this.properties.getDatabase())
			.username(this.properties.getUsername())
			.password(this.properties.getPassword())
			.build();

	context.registerBean(DatabaseClient.class, () -> DatabaseClient.builder().connectionFactory(new PostgresqlConnectionFactory(configuration)).build());
}
 
Example #2
Source File: InfrastructureConfiguration.java    From Hands-On-Reactive-Programming-in-Spring-5 with MIT License 6 votes vote down vote up
@Bean
PostgresqlConnectionFactory connectionFactory(DatabaseLocation databaseLocation) {

   PostgresqlConnectionConfiguration config = PostgresqlConnectionConfiguration.builder()
      .host(databaseLocation.getHost())
      .port(databaseLocation.getPort())
      .database(databaseLocation.getDatabase())
      .username(databaseLocation.getUser())
      .password(databaseLocation.getPassword())
      .build();

   return new PostgresqlConnectionFactory(config);
}
 
Example #3
Source File: ReservationServiceApplication.java    From bootiful-reactive-microservices with Apache License 2.0 6 votes vote down vote up
@Override
public ConnectionFactory connectionFactory() {
	PostgresqlConnectionConfiguration config = PostgresqlConnectionConfiguration
		.builder()
		.host("localhost")
		.password("0rd3rs")
		.username("orders")
		.database("orders")
		.build();
	return new PostgresqlConnectionFactory(config);
}
 
Example #4
Source File: DatabaseConfig.java    From spring-reactive-sample with GNU General Public License v3.0 6 votes vote down vote up
@Override
@Bean
public ConnectionFactory connectionFactory() {
    //ConnectionFactory factory = ConnectionFactories.get("r2dbc:h2:mem:///test?options=DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
    return new PostgresqlConnectionFactory(
            PostgresqlConnectionConfiguration.builder()
                    .host("localhost")
                    .database("test")
                    .username("user")
                    .password("password").build()
    );
}
 
Example #5
Source File: ReservationServiceApplication.java    From bootiful-reactive-microservices with Apache License 2.0 5 votes vote down vote up
@Override
public ConnectionFactory connectionFactory() {
	return new PostgresqlConnectionFactory(
		PostgresqlConnectionConfiguration
			.builder()
			.password("0rd3rs")
			.username("orders")
			.host("localhost")
			.database("orders")
			.applicationName("orders")
			.build()
	);
}
 
Example #6
Source File: DataSourceConfiguration.java    From event-sourcing-microservices-example with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
private PostgresqlConnectionFactory getPostgresqlConnectionFactory() {
	return new PostgresqlConnectionFactory(PostgresqlConnectionConfiguration.builder()
			.applicationName(applicationName)
			.database(databaseName)
			.host(postgresHost)
			.port(postgresPort)
			.username(dataSourceProperties.getDataUsername())
			.password(dataSourceProperties.getDataPassword()).build());
}
 
Example #7
Source File: DataSourceConfiguration.java    From event-sourcing-microservices-example with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
private PostgresqlConnectionFactory getPostgresqlConnectionFactory() {
	return new PostgresqlConnectionFactory(PostgresqlConnectionConfiguration.builder()
			.applicationName(applicationName)
			.database(databaseName)
			.host(postgresHost)
			.port(postgresPort)
			.username(dataSourceProperties.getDataUsername())
			.password(dataSourceProperties.getDataPassword()).build());
}
 
Example #8
Source File: ConnectionFactoryConfig.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
@Bean
@Override
public ConnectionFactory connectionFactory() {
  return new PostgresqlConnectionFactory(PostgresqlConnectionConfiguration.builder()
      .host(POSTGRE_SQL_CONTAINER.getContainerIpAddress())
      .port(POSTGRE_SQL_CONTAINER.getMappedPort(POSTGRESQL_PORT))
      .database(POSTGRE_SQL_CONTAINER.getDatabaseName())
      .username(POSTGRE_SQL_CONTAINER.getUsername())
      .password(POSTGRE_SQL_CONTAINER.getPassword())
      .build());
}