application.yml
3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
spring:
application:
name: notification-service
profiles:
active: prod
datasource:
url: jdbc:postgresql://postgresql-service:5432/ecommerce_notifications
username: ${DB_USERNAME:admin}
password: ${DB_PASSWORD:postgres123}
driver-class-name: org.postgresql.Driver
# 添加 HikariCP 连接池配置
hikari:
connection-timeout: 30000
maximum-pool-size: 10
minimum-idle: 2
idle-timeout: 600000
max-lifetime: 1800000
connection-test-query: SELECT 1
# ========== Flyway 数据库迁移配置 ==========
flyway:
enabled: true
locations: classpath:db/migration
baseline-on-migrate: true
validate-on-migrate: true
# 生产环境配置
out-of-order: false
# 验证规则
ignore-missing-migrations: true
ignore-future-migrations: true
ignore-ignored-migrations: true
ignore-pending-migrations: true
# 修复配置
repair-on-migrate: true
validate-migration-naming: true
placeholder-replacement: false
# 添加基线配置
baseline-version: 0
baseline-description: "Base migration"
# 表名配置
table: flyway_schema_history_notifications
# 生产环境推荐禁用清理(只保留这一个)
clean-disabled: true
# =========================================
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
show_sql: false
format_sql: true
jdbc:
lob:
non_contextual_creation: true
# 移除有问题的配置
check_nullability: false
# 禁用 Spring Boot 的 SQL 初始化
sql:
init:
mode: never
mail:
host: ${SMTP_HOST:smtp.gmail.com}
port: ${SMTP_PORT:587}
username: ${SMTP_USERNAME:your-email@gmail.com}
password: ${SMTP_PASSWORD:your-app-password}
properties:
mail:
smtp:
auth: true
starttls:
enable: true
transport:
protocol: smtp
debug: false
rabbitmq:
host: rabbitmq
port: 5672
username: ${RABBITMQ_USERNAME:admin}
password: ${RABBITMQ_PASSWORD:rabbitmq123}
virtual-host: /
connection-timeout: 5000
server:
port: 8080
servlet:
context-path: /api
eureka:
client:
service-url:
defaultZone: http://service-registry:8761/eureka/
register-with-eureka: true
fetch-registry: true
management:
endpoints:
web:
exposure:
include: health,info,metrics,prometheus,flyway
# 添加管理端点路径
base-path: /management
endpoint:
health:
show-details: when_authorized
show-components: when_authorized
# 添加健康检查组
group:
custom:
include: db,rabbitmq,mail
# Flyway 端点
flyway:
enabled: true
# 指标端点
metrics:
enabled: true
logging:
level:
com.ecommerce.notification: INFO
org.springframework.amqp: WARN
org.hibernate.SQL: WARN
org.springframework.mail: WARN
org.flywaydb: INFO
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
springdoc:
api-docs:
path: /v3/api-docs
swagger-ui:
path: /swagger-ui.html
operations-sorter: method
# Scheduled tasks for processing pending notifications
scheduling:
enabled: true
# 应用自定义配置
app:
database:
lenient-schema-validation: true
auto-repair-missing-columns: false
notification:
# 通知配置
email-enabled: ${NOTIFICATION_EMAIL_ENABLED:false}
sms-enabled: ${NOTIFICATION_SMS_ENABLED:false}
push-enabled: ${NOTIFICATION_PUSH_ENABLED:false}
# 重试配置
max-retry-attempts: 3
retry-delay-seconds: 60
# 批量处理配置
batch-size: 100