Java Code Examples for io.r2dbc.postgresql.PostgresqlConnectionConfiguration

The following examples show how to use io.r2dbc.postgresql.PostgresqlConnectionConfiguration. These examples are extracted from open source projects. 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
@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
@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
@Override
public ConnectionFactory connectionFactory() {
	PostgresqlConnectionConfiguration config = PostgresqlConnectionConfiguration
		.builder()
		.host("localhost")
		.password("0rd3rs")
		.username("orders")
		.database("orders")
		.build();
	return new PostgresqlConnectionFactory(config);
}
 
Example 4
@Override
public ConnectionFactory connectionFactory() {
	return new PostgresqlConnectionFactory(
		PostgresqlConnectionConfiguration
			.builder()
			.password("0rd3rs")
			.username("orders")
			.host("localhost")
			.database("orders")
			.applicationName("orders")
			.build()
	);
}
 
Example 5
@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 6
@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
@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
@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());
}