Skip to content

Commit

Permalink
fix : Issues with Junit
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Nov 2, 2024
1 parent 5b1e463 commit 9f20024
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
2 changes: 0 additions & 2 deletions jpa/boot-read-replica-postgresql/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '2'

services:
postgresql-master:
image: 'bitnami/postgresql:latest'
Expand Down
4 changes: 2 additions & 2 deletions jpa/boot-read-replica-postgresql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.5</version>
<version>3.4.0-RC1</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example.demo</groupId>
Expand Down Expand Up @@ -109,7 +109,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.22.0</version>
<version>1.24.0</version>
<style>AOSP</style>
</googleJavaFormat>
</java>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DataSourceProperties primaryDataSourceProperties() {
}

@Bean
@ConfigurationProperties(PRIMARY_DATABASE_PROPERTY_KEY_PREFIX + ".configuration")
@ConfigurationProperties(PRIMARY_DATABASE_PROPERTY_KEY_PREFIX + ".hikari")
DataSource primaryDataSource(final DataSourceProperties primaryDataSourceProperties) {
return primaryDataSourceProperties
.initializeDataSourceBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ spring:
username: postgres_write
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/my_database
configuration:
hikari:
auto-commit: false
poolName: primaryHikariPool
pool-name: primaryHikariPool
data-source-properties:
ApplicationName: ${spring.application.name}
replica:
datasource:
password: repl_password
Expand All @@ -18,26 +20,46 @@ spring:
hikari:
auto-commit: false
poolName: replicaHikariPool

################ Database #####################
data:
jpa:
repositories:
bootstrap-mode: deferred
jpa:
open-in-view: false
show-sql: false
hibernate:
ddl-auto: validate
properties:
hibernate:
connection:
provider_disables_autocommit: true
jdbc:
time_zone: UTC
batch_size: 25
lob.non_contextual_creation : true
generate_statistics: false
order_inserts: true
order_updates: true
query:
fail_on_pagination_over_collection_fetch: true
in_clause_parameter_padding: true
plan_cache_max_size: 4096
threads:
virtual:
enabled: true

# spring boot log level property
logging:
level:
read-replica-logger : DEBUG
read-replica-logger: DEBUG
jdbc:
excludedDataSourceBeanNames: dataSource
datasource-proxy:
enabled: true
multiline: false
logging: slf4j
query:
logger-name: read-replica-logger
log-level: DEBUG
enable-logging: true
enabled: true
excluded-data-source-bean-names: dataSource
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
import org.springframework.jdbc.UncategorizedSQLException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.util.ReflectionTestUtils;

@ActiveProfiles("test")
@SpringBootTest
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#since tests uses only jdbc template, connection optimizations handled by jps is gone, to enabling autocommit
spring.primary.datasource.hikari.auto-commit=true

0 comments on commit 9f20024

Please sign in to comment.