org.springframework.data.r2dbc.core.DatabaseClient Java Examples
The following examples show how to use
org.springframework.data.r2dbc.core.DatabaseClient.
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: MssqlDatabaseClientInitializer.java From spring-fu with Apache License 2.0 | 7 votes |
@Override public void initialize(GenericApplicationContext context) { MssqlConnectionConfiguration.Builder builder = MssqlConnectionConfiguration .builder() .host(this.properties.getHost()) .port(this.properties.getPort()) .database(this.properties.getDatabase()) .username(this.properties.getUsername()) .password(this.properties.getPassword()) .connectTimeout(this.properties.getConnectTimeout()) .preferCursoredExecution(this.properties.isPreferCursoredExecution()); if (this.properties.isSsl()) { builder.enableSsl(); } MssqlConnectionConfiguration configuration = builder.build(); context.registerBean(DatabaseClient.class, () -> DatabaseClient.builder().connectionFactory(new MssqlConnectionFactory(configuration)).build()); }
Example #2
Source File: PostgresqlDatabaseClientInitializer.java From spring-fu with Apache License 2.0 | 6 votes |
@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 #3
Source File: SpannerR2dbcDialectIT.java From cloud-spanner-r2dbc with Apache License 2.0 | 6 votes |
/** * Initializes the integration test environment for the Spanner R2DBC dialect. */ @BeforeEach public void initializeTestEnvironment() { Connection connection = Mono.from(connectionFactory.create()).block(); this.databaseClient = DatabaseClient.create(connectionFactory); if (SpannerTestUtils.tableExists(connection, "PRESIDENT")) { this.databaseClient.execute("DROP TABLE PRESIDENT") .fetch() .rowsUpdated() .block(); } this.databaseClient.execute( "CREATE TABLE PRESIDENT (" + " NAME STRING(256) NOT NULL," + " START_YEAR INT64 NOT NULL" + ") PRIMARY KEY (NAME)") .fetch() .rowsUpdated() .block(); }
Example #4
Source File: R2dbcAppMetricsRepository.java From cf-butler with Apache License 2.0 | 5 votes |
@Autowired public R2dbcAppMetricsRepository( DatabaseClient client, DbmsSettings settings) { this.client = client; this.settings = settings; }
Example #5
Source File: H2DatabaseClientInitializer.java From spring-fu with Apache License 2.0 | 5 votes |
@Override public void initialize(GenericApplicationContext context) { H2ConnectionConfiguration configuration = H2ConnectionConfiguration .builder() .url(this.properties.getUrl()) .username(this.properties.getUsername()) .password(this.properties.getPassword()) .build(); context.registerBean(DatabaseClient.class, () -> DatabaseClient.builder().connectionFactory(new H2ConnectionFactory(configuration)).build()); }
Example #6
Source File: TraditionalApplication.java From spring-graalvm-native with Apache License 2.0 | 5 votes |
@Bean ApplicationRunner runner(DatabaseClient dbc, ReservationRepository reservationRepository) { return args -> { dbc.execute("create table reservation\n" + "(\n" + " id serial primary key,\n" + " name varchar(255) not null\n" + ")").fetch().rowsUpdated().subscribe(); reservationRepository.save(new Reservation(null, "Andy")).subscribe(); reservationRepository.save(new Reservation(null, "Sebastien")).subscribe(); reservationRepository.findAll().subscribe(System.out::println); ; }; }
Example #7
Source File: DatabaseCreator.java From cf-butler with Apache License 2.0 | 5 votes |
@Autowired public DatabaseCreator( DatabaseClient client, ResourceLoader resourceLoader, DbmsSettings settings, ApplicationEventPublisher publisher) { this.client = client; this.resourceLoader = resourceLoader; this.settings = settings; this.publisher = publisher; }
Example #8
Source File: MysqlDatabaseClientInitializer.java From spring-fu with Apache License 2.0 | 5 votes |
@Override public void initialize(GenericApplicationContext context) { JasyncConnectionFactory jasyncConnectionFactory = new JasyncConnectionFactory(new MySQLConnectionFactory( URLParser.INSTANCE.parseOrDie(properties.getUrl(), StandardCharsets.UTF_8))); context.registerBean(DatabaseClient.class, () -> DatabaseClient.builder().connectionFactory(jasyncConnectionFactory).build()); }
Example #9
Source File: R2dbcPoliciesRepository.java From cf-butler with Apache License 2.0 | 5 votes |
@Autowired public R2dbcPoliciesRepository( DatabaseClient dbClient, PolicyIdProvider idProvider, ObjectMapper mapper) { this.dbClient = dbClient; this.idProvider = idProvider; this.mapper = mapper; }
Example #10
Source File: DataInitializer.java From spring-reactive-sample with GNU General Public License v3.0 | 4 votes |
public DataInitializer(DatabaseClient databaseClient) { this.databaseClient = databaseClient; }
Example #11
Source File: UserRepository.java From spring-fu with Apache License 2.0 | 4 votes |
public UserRepository(DatabaseClient client) { this.client = client; }
Example #12
Source File: DataInitializer.java From spring-reactive-sample with GNU General Public License v3.0 | 4 votes |
public DataInitializer(DatabaseClient databaseClient) { this.databaseClient = databaseClient; }
Example #13
Source File: DataInitializer.java From spring-reactive-sample with GNU General Public License v3.0 | 4 votes |
public DataInitializer(DatabaseClient databaseClient) { this.databaseClient = databaseClient; }
Example #14
Source File: DataInitializer.java From spring-reactive-sample with GNU General Public License v3.0 | 4 votes |
public DataInitializer(DatabaseClient databaseClient) { this.databaseClient = databaseClient; }
Example #15
Source File: DataInitializer.java From spring-reactive-sample with GNU General Public License v3.0 | 4 votes |
public DataInitializer(DatabaseClient databaseClient) { this.databaseClient = databaseClient; }
Example #16
Source File: R2dbcDbRepository.java From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License | 4 votes |
public R2dbcDbRepository(DatabaseClient databaseClient) { this.databaseClient = databaseClient; }
Example #17
Source File: R2dbcConfig.java From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Bean public DatabaseClient databaseClient(ConnectionFactory connectionFactory) { return DatabaseClient.create(connectionFactory); }
Example #18
Source File: R2dbcAppRelationshipRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcAppRelationshipRepository(DatabaseClient client) { this.client = client; }
Example #19
Source File: R2dbcQueryRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcQueryRepository(DatabaseClient client) { this.client = client; }
Example #20
Source File: R2dbcSpaceRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcSpaceRepository(DatabaseClient client) { this.client = client; }
Example #21
Source File: R2dbcServiceInstanceDetailRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcServiceInstanceDetailRepository(DatabaseClient client) { this.client = client; }
Example #22
Source File: R2dbcHistoricalRecordRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcHistoricalRecordRepository(DatabaseClient client) { this.client = client; }
Example #23
Source File: R2dbcTkRepository.java From cf-butler with Apache License 2.0 | 4 votes |
public R2dbcTkRepository(DatabaseClient client) { this.client = client; }
Example #24
Source File: R2dbcOrganizationRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcOrganizationRepository(DatabaseClient client) { this.client = client; }
Example #25
Source File: R2dbcAppDetailRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcAppDetailRepository(DatabaseClient client) { this.client = client; }
Example #26
Source File: R2dbcSpaceUsersRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcSpaceUsersRepository(DatabaseClient client) { this.client = client; }
Example #27
Source File: R2dbcServiceInstanceMetricsRepository.java From cf-butler with Apache License 2.0 | 4 votes |
@Autowired public R2dbcServiceInstanceMetricsRepository( DatabaseClient client) { this.client = client; }
Example #28
Source File: R2dbcBenchmark.java From spring-data-dev-tools with Apache License 2.0 | 3 votes |
@Setup public void setUp() { R2dbcFixture fixture = new R2dbcFixture(profile); ConfigurableApplicationContext context = fixture.getContext(); this.operations = context.getBean(DatabaseClient.class); this.mapper = row -> new Book(row.get("id", Long.class), row.get("title", String.class), row.get("pages", Integer.class)); this.repository = context.getBean(R2dbcBookRepository.class); }