* fix(hibernate): improve transaction management and optimize entity fetching * chore(tests): clean-up comments * chore: fix config issue in the kotlin dsl * fix(hibernate): fix entity equality checks * fix(hibernate): add transactional read-only support to BookService * Update booklore-api/src/main/java/org/booklore/model/entity/BookLoreUserEntity.java Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix(hibernate): remove redundant annotations in BookLoreUserEntity * fix(hibernate): import Hibernate * fix(tests): fix merge conflict caused errors * refactor(book): optimize book retrieval methods and reduce cache sizes * refactor(metadata): remove lazy loading from description field in BookMetadataEntity * fix(build): increase max heap size for test tasks --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
122 lines
4.7 KiB
YAML
122 lines
4.7 KiB
YAML
app:
|
|
path-config: '/app/data'
|
|
bookdrop-folder: '/bookdrop'
|
|
version: ${APP_VERSION:development}
|
|
api-docs:
|
|
enabled: ${API_DOCS_ENABLED:false}
|
|
|
|
cors:
|
|
# Comma-separated list of allowed CORS origins.
|
|
# Leave empty (default) to allow same-origin requests only.
|
|
# Example: ALLOWED_ORIGINS=https://app.example.com,https://mobile.example.com
|
|
allowed-origins: ${ALLOWED_ORIGINS:*}
|
|
|
|
remote-auth:
|
|
enabled: ${REMOTE_AUTH_ENABLED:false}
|
|
create-new-users: ${REMOTE_AUTH_CREATE_NEW_USERS:true}
|
|
header-name: ${REMOTE_AUTH_HEADER_NAME:Remote-Name}
|
|
header-user: ${REMOTE_AUTH_HEADER_USER:Remote-User}
|
|
header-email: ${REMOTE_AUTH_HEADER_EMAIL:Remote-Email}
|
|
header-groups: ${REMOTE_AUTH_HEADER_GROUPS:Remote-Groups}
|
|
admin-group: ${REMOTE_AUTH_ADMIN_GROUP}
|
|
groups-delimiter: ${REMOTE_AUTH_GROUPS_DELIMITER:\\s+}
|
|
force-disable-oidc: ${FORCE_DISABLE_OIDC:false}
|
|
disk-type: ${DISK_TYPE:LOCAL}
|
|
|
|
server:
|
|
forward-headers-strategy: native
|
|
port: ${BOOKLORE_PORT:6060}
|
|
compression:
|
|
enabled: true
|
|
mime-types: text/html,text/css,application/javascript,application/json,image/svg+xml,application/xml,application/atom+xml
|
|
min-response-size: 1024
|
|
tomcat:
|
|
relaxed-query-chars: '[,],%,{,},|'
|
|
threads:
|
|
max: 10 # Virtual threads handle concurrency; platform threads just overhead
|
|
min-spare: 2
|
|
max-http-request-header-size: 64KB
|
|
|
|
spring:
|
|
jackson:
|
|
deserialization:
|
|
fail-on-null-for-primitives: false
|
|
servlet:
|
|
multipart:
|
|
enabled: true
|
|
max-file-size: 1024MB
|
|
max-request-size: 1024MB
|
|
file-size-threshold: 0
|
|
mvc:
|
|
async:
|
|
request-timeout: 600000
|
|
application:
|
|
name: booklore-api
|
|
data:
|
|
web:
|
|
pageable:
|
|
max-page-size: 100
|
|
datasource:
|
|
url: ${DATABASE_URL:jdbc:mariadb://${DATABASE_HOST:${DB_HOST:mariadb}}:${DATABASE_PORT:3306}/${DATABASE_NAME:booklore}?createDatabaseIfNotExist=true&connectionTimeZone=UTC&forceConnectionTimeZoneToSession=true}
|
|
username: ${DATABASE_USERNAME:root}
|
|
password: ${DATABASE_PASSWORD:${MYSQL_ROOT_PASSWORD}}
|
|
hikari:
|
|
pool-name: BookloreHikariPool
|
|
auto-commit: false # Required counterpart to provider_disables_autocommit
|
|
max-lifetime: 580000 # 9.6 minutes (avoid DB-side connection cuts)
|
|
connection-test-query: SELECT 1
|
|
connection-timeout: 30000 # 30s to acquire a connection before timeout
|
|
maximum-pool-size: 10 # Virtual threads don't need large pools
|
|
minimum-idle: 2 # Minimal warm connections; virtual threads handle bursts
|
|
idle-timeout: 300000 # 5 minutes before idle connections are closed
|
|
jpa:
|
|
open-in-view: false
|
|
hibernate:
|
|
naming:
|
|
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
|
show-sql: false
|
|
properties:
|
|
hibernate:
|
|
query:
|
|
timeout: 30 # 30s max for any HQL/JPQL query
|
|
plan_cache_max_size: 128 # Reduce from 2048 default; small self-hosted app
|
|
plan_parameter_metadata_max_size: 32 # Reduce from 128 default
|
|
in_clause_parameter_padding: true # Pad IN params to power-of-2; fewer unique plan cache entries
|
|
fail_on_pagination_over_collection_fetch: true # Fail fast when paginating over collection fetches (in-memory pagination)
|
|
jdbc:
|
|
time_zone: UTC
|
|
batch_size: 100
|
|
fetch_size: 50 # Reduce JDBC roundtrips for large result sets
|
|
order_inserts: true
|
|
order_updates: true
|
|
batch_versioned_data: true # Allow batching UPDATEs on @Version entities
|
|
connection:
|
|
provider_disables_autocommit: true # Skip unnecessary JDBC autocommit check; reduces roundtrips
|
|
default_batch_fetch_size: 16 # Global batch fetch for all lazy collections (prevents N+1)
|
|
log_slow_query: ${HIBERNATE_SLOW_QUERY_MS:500} # Log queries taking longer than 500ms (see org.hibernate.SQL_SLOW)
|
|
generate_statistics: ${HIBERNATE_STATISTICS:false}
|
|
threads:
|
|
virtual:
|
|
enabled: true
|
|
flyway:
|
|
enabled: true
|
|
locations: classpath:db/migration
|
|
|
|
springdoc:
|
|
api-docs:
|
|
enabled: ${app.api-docs.enabled:false}
|
|
path: /api/openapi.json
|
|
|
|
logging:
|
|
level:
|
|
root: ${ROOT_LOG_LEVEL:INFO}
|
|
org.booklore: ${LOG_LEVEL:INFO}
|
|
org.apache.fontbox: ERROR
|
|
org.apache.pdfbox: ERROR
|
|
org.quartz.core.QuartzScheduler: WARN
|
|
org.quartz.simpl.SimpleThreadPool: WARN
|
|
org.quartz.simpl.RAMJobStore: WARN
|
|
org.hibernate.orm.connections.pooling: WARN
|
|
org.hibernate.session.metrics: ${HIBERNATE_METRICS_LOG_LEVEL:WARN}
|
|
org.springframework.security.config.annotation.authentication.configuration.InitializeUserDetailsBeanManagerConfigurer: ERROR
|