Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions backend/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@ spring:
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
data.mongodb:
host: ${MONGO_HOST}
port: ${MONGO_PORT}
database: ${MONGO_DATABASE}
username: ${MONGO_USERNAME}
password: ${MONGO_PASSWORD}
authentication-database: ${MONGO_AUTH_DATABASE}
data:
mongodb:
host: ${MONGO_HOST}
port: ${MONGO_PORT}
database: ${MONGO_DATABASE}
username: ${MONGO_USERNAME}
password: ${MONGO_PASSWORD}
authentication-database: ${MONGO_AUTH_DATABASE}

# Connection Pool 설정
max-pool-size: 30
min-pool-size: 10

# timeout 설정
max-wait-time: 2000
socket-timeout: 3000
connect-timeout: 1000
max-connection-idle-time: 30000
Comment on lines +19 to +26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, find the Spring Boot version
if [ -f "pom.xml" ]; then
  echo "=== pom.xml found ==="
  grep -A 2 -B 2 "spring-boot" pom.xml | head -20
elif [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]; then
  echo "=== Gradle build file found ==="
  grep -i "spring.*boot" build.gradle* 2>/dev/null | head -20
fi

Repository: woowacourse-teams/2025-course-pick

Length of output: 60


🏁 Script executed:

# Also check if there's a parent pom or version file
find . -type f \( -name "pom.xml" -o -name "build.gradle*" -o -name "*.properties" \) | grep -E "(pom|build|version)" | head -20

Repository: woowacourse-teams/2025-course-pick

Length of output: 162


🏁 Script executed:

# Check the backend build.gradle.kts for Spring Boot version
cat backend/build.gradle.kts | head -50

Repository: woowacourse-teams/2025-course-pick

Length of output: 1405


🌐 Web query:

Spring Boot 3.5.3 MongoDB connection pool properties spring.data.mongodb max-pool-size socket-timeout

💡 Result:

In Spring Boot 3.5.x, Spring Boot’s spring.data.mongodb.* properties do not include dedicated “pool” or “socket timeout” fields (Boot mainly exposes spring.data.mongodb.uri, etc.). (docs.spring.io)
So, to set max pool size and socket timeout, use one of these approaches:

1) Put driver options on spring.data.mongodb.uri (recommended for simple config)

MongoDB Java driver supports these URI options:

  • Pool size: maxPoolSize (and minPoolSize)
  • Timeouts: connectTimeoutMS, socketTimeoutMS (note: socketTimeoutMS is deprecated in newer driver docs in favor of client-level timeout) (mongodb.com)

Example (application.yml):

spring:
  data:
    mongodb:
      uri: mongodb://user:pass@host:27017/mydb?maxPoolSize=50&connectTimeoutMS=10000&socketTimeoutMS=15000

Defaults worth knowing: maxPoolSize defaults to 100 if not set. (mongodb.ac.cn)

2) Customize MongoClientSettings (best if you want “typed” config / advanced tuning)

Spring Boot builds the client using MongoClientSettings, and the MongoDB driver lets you set pool and socket settings there (e.g., socket read timeout). (mongodb.com)

Citations:


🌐 Web query:

Spring Data MongoDB connection pool configuration spring.data.mongodb.uri options replicaSet maxPoolSize socketTimeoutMS

💡 Result:

In Spring Boot / Spring Data MongoDB you can pass MongoDB driver connection-string options directly via spring.data.mongodb.uri, and Spring Boot will apply them when it auto-configures MongoClientSettings. (docs.spring.io)

1) Configure via spring.data.mongodb.uri (replicaSet, pool, timeouts)

Example:

spring.data.mongodb.uri=mongodb://user:pass@host1:27017,host2:27017,host3:27017/mydb\
?replicaSet=rs0\
&maxPoolSize=200\
&minPoolSize=10\
&socketTimeoutMS=45000\
&connectTimeoutMS=10000

Relevant URI options (driver-level):

  • replicaSet (replica set name) (mongodb.com)
  • maxPoolSize / minPoolSize (connection pool sizing; maxPoolSize default is 100) (mongodb.com)
  • socketTimeoutMS (socket read/write timeout; docs note default “never timeout”, driver-dependent) (mongodb.com)
  • connectTimeoutMS (connect timeout) (mongodb.com)

Note: in the Java driver, pool sizing applies per server in the topology. (mongodb.com)

2) When URI options aren’t enough: customize MongoClientSettings

Spring Boot supports MongoClientSettingsBuilderCustomizer to fine-tune MongoClientSettings. (docs.spring.io)

Citations:


🏁 Script executed:

cat backend/src/main/resources/application-prod.yml

Repository: woowacourse-teams/2025-course-pick

Length of output: 901


Spring Boot 3.5.3에서는 지정한 MongoDB 풀/타임아웃 속성들이 지원되지 않습니다.

현재 설정의 max-pool-size, min-pool-size, max-wait-time, socket-timeout, connect-timeout, max-connection-idle-time은 Spring Boot 3.5.3에서 인식되지 않는 속성으로, 이들은 무시되고 PR의 목적(커넥션 풀 조정)이 전혀 반영되지 않습니다.

다음 중 하나의 방법으로 수정하세요:

  1. spring.data.mongodb.uri를 사용 (권장):

    spring:
      data:
        mongodb:
          uri: mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}/${MONGO_DATABASE}?authSource=${MONGO_AUTH_DATABASE}&maxPoolSize=30&minPoolSize=10&connectTimeoutMS=1000&socketTimeoutMS=3000
  2. MongoClientSettingsBuilderCustomizer 빈 생성: 더 복잡한 설정이 필요한 경우 커스텀 빈을 작성하여 MongoClientSettings를 직접 구성합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/src/main/resources/application-prod.yml` around lines 19 - 26, The
YAML uses unsupported MongoDB pool/timeout properties (max-pool-size,
min-pool-size, max-wait-time, socket-timeout, connect-timeout,
max-connection-idle-time) for Spring Boot 3.5.3 so replace them by either
setting connection options in the Mongo URI via spring.data.mongodb.uri (include
maxPoolSize, minPoolSize, connectTimeoutMS, socketTimeoutMS, authSource as query
params) or implement a MongoClientSettingsBuilderCustomizer bean to
programmatically set MongoClientSettings (configure connectionPoolSettings and
socketSettings/connectTimeouts) so the pool/timeouts take effect.


springdoc:
api-docs.enabled: false
Expand Down