Conversation
|
Warning Rate limit exceeded@Kosw6 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 58 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
Walkthrough프로덕션(prod), 개발(dev), 그 외 환경을 구분해 활성 Spring 프로필을 검사하도록 변경했습니다. OAuth2 성공 핸들러와 보안 설정에서 환경별 쿠키 속성(sameSite/secure), 도메인, 리다이렉트 URL, CORS 허용 원본을 분기 처리하도록 추가 및 조정했고, 두 데이터 소스 구성 클래스에 Changes
Estimated code review effort🎯 3 (보통) | ⏱️ ~20분
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
backend/src/main/java/org/sejongisc/backend/common/auth/config/OAuth2SuccessHandler.java(1 hunks)backend/src/main/java/org/sejongisc/backend/common/auth/config/SecurityConfig.java(3 hunks)backend/src/main/java/org/sejongisc/backend/common/config/PrimaryDataSourceConfig.java(1 hunks)backend/src/main/java/org/sejongisc/backend/common/config/StockDataSourceConfig.java(2 hunks)
🔇 Additional comments (5)
backend/src/main/java/org/sejongisc/backend/common/auth/config/SecurityConfig.java (2)
47-49: LGTM!
isDev()헬퍼 메서드가 기존isProd()와 동일한 패턴으로 올바르게 구현되었습니다.
130-131: LGTM!프로덕션 도메인
https://sjusisc.com이 CORS 허용 목록에 올바르게 추가되었습니다.backend/src/main/java/org/sejongisc/backend/common/config/StockDataSourceConfig.java (1)
10-10: LGTM!
Profileimport가 올바르게 추가되었습니다.backend/src/main/java/org/sejongisc/backend/common/auth/config/OAuth2SuccessHandler.java (2)
104-107: LGTM!프로파일 감지 로직이 올바르게 구현되었습니다.
isProd와isDev플래그를 통해 환경별로 다른 동작을 지원할 수 있습니다.
110-111: LGTM!쿠키 보안 설정이 프로파일에 따라 적절하게 구성되었습니다. 프로덕션에서는
SameSite=None과Secure=true를 사용하고, 개발 환경에서는SameSite=Lax와Secure=false를 사용합니다.
backend/src/main/java/org/sejongisc/backend/common/auth/config/OAuth2SuccessHandler.java
Show resolved
Hide resolved
backend/src/main/java/org/sejongisc/backend/common/auth/config/SecurityConfig.java
Show resolved
Hide resolved
|
|
||
| @Configuration | ||
| @EnableTransactionManagement | ||
| @Profile("dev") |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for prod profile datasource configurations
echo "=== Searching for @Profile(\"prod\") annotations ==="
rg -n '@Profile.*prod' --type java -A 3
echo -e "\n=== Searching for prod-specific configuration files ==="
fd -e yml -e yaml -e properties 'application-prod'
echo -e "\n=== Checking directory structure for datasource configs ==="
find . -path ./\.git -prune -o -type f -name '*DataSource*.java' -print
echo -e "\n=== Searching for all @Profile annotations in config directory ==="
rg -n '@Profile' backend/src/main/java/org/sejongisc/backend/common/config/ --type java -B 2 -A 2Repository: SISC-IT/sisc-web
Length of output: 1646
🏁 Script executed:
#!/bin/bash
echo "=== Searching for application configuration files ==="
fd -e yml -e yaml -e properties 'application' | grep -E 'application(-|\.)(yml|yaml|properties)$'
echo -e "\n=== Checking main resources directory ==="
ls -la backend/src/main/resources/ 2>/dev/null || echo "resources dir not found"
echo -e "\n=== Examining PrimaryDataSourceConfig.java ==="
cat -n backend/src/main/java/org/sejongisc/backend/common/config/PrimaryDataSourceConfig.java
echo -e "\n=== Examining StockDataSourceConfig.java ==="
cat -n backend/src/main/java/org/sejongisc/backend/common/config/StockDataSourceConfig.javaRepository: SISC-IT/sisc-web
Length of output: 9475
🏁 Script executed:
cat -n backend/src/main/resources/application.ymlRepository: SISC-IT/sisc-web
Length of output: 477
Production datasource configuration is missing—application will fail to start in production.
The @Profile("dev") annotation restricts PrimaryDataSourceConfig and StockDataSourceConfig to the dev profile only. However, application.yml sets spring.profiles.active: prod with no datasource properties defined. In production, Spring Boot will fail to auto-configure datasources without connection parameters (url, username, password), and the custom EntityManager and TransactionManager beans won't be instantiated.
Create application-prod.yml with production datasource configuration, or remove the @Profile("dev") restriction and adjust the configuration to support both profiles.
🤖 Prompt for AI Agents
In
backend/src/main/java/org/sejongisc/backend/common/config/PrimaryDataSourceConfig.java
around line 24, the class is annotated with @Profile("dev") which restricts
datasource beans to the dev profile and will cause startup failure in prod since
application.yml activates prod but no datasource properties exist; remove the
@Profile("dev") annotation (and the same annotation in StockDataSourceConfig) or
add a production datasource configuration file (create application-prod.yml)
that supplies spring.datasource.url/username/password (or configure
profile-specific properties) so the custom EntityManager/TransactionManager
beans are available in production.
|
|
||
| @Configuration | ||
| @EnableTransactionManagement | ||
| @Profile("dev") |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all datasource-related config files
fd -type f -name '*DataSourceConfig.java' backend/src/main/java/
# Check for all profile annotations in config directory
rg -n '@Profile' backend/src/main/java/org/sejongisc/backend/common/config/ -A 2 -B 1
# Look for application configuration files
fd -type f -name 'application*.yml' -o -name 'application*.properties' backend/src/main/resources/Repository: SISC-IT/sisc-web
Length of output: 1384
🏁 Script executed:
#!/bin/bash
# Read the StockDataSourceConfig file
cat -n backend/src/main/java/org/sejongisc/backend/common/config/StockDataSourceConfig.java
# Read the PrimaryDataSourceConfig file
cat -n backend/src/main/java/org/sejongisc/backend/common/config/PrimaryDataSourceConfig.java
# Check for all config files in the config directory
ls -la backend/src/main/java/org/sejongisc/backend/common/config/Repository: SISC-IT/sisc-web
Length of output: 9410
🏁 Script executed:
#!/bin/bash
# Find all application configuration files
find backend/src/main/resources -name "application*.yml" -o -name "application*.properties" | sort
# Read the main application.yml
cat backend/src/main/resources/application.yml
# Check if there's an application-prod file
find backend/src/main/resources -name "application-prod*"
# Check for other profile-specific configs
ls -la backend/src/main/resources/Repository: SISC-IT/sisc-web
Length of output: 639
🏁 Script executed:
#!/bin/bash
# Check if there are any other Config classes that might provide datasource for prod
rg -n '@Configuration' backend/src/main/java/org/sejongisc/backend/common/config/ -A 5
# Search for any prod-specific datasource beans in the entire codebase
rg -n '@Profile.*prod' backend/src/main/java/ -A 3
# Check if there are conditional beans or default configurations
rg -n '@ConditionalOnProfile|@ConditionalOnMissingBean' backend/src/main/java/org/sejongisc/backend/common/config/Repository: SISC-IT/sisc-web
Length of output: 5535
Stock 데이터소스 구성이 프로덕션 환경에서 누락되었습니다.
@Profile("dev") 애노테이션이 추가되면서 StockDataSourceConfig는 dev 프로파일에서만 활성화되지만, application.yml에서 활성 프로파일이 prod로 설정되어 있습니다. PrimaryDataSourceConfig 역시 동일하게 @Profile("dev")를 가지고 있어, 프로덕션 환경에서는 두 데이터소스 모두 구성되지 않습니다.
프로덕션 환경을 위한 datasource 구성이 필요합니다:
application-prod.yml파일 생성 및 prod 프로파일 설정, 또는- 프로덕션 환경을 위한 별도의 datasource config 클래스 작성 (예:
@Profile("prod")애노테이션 추가)
@Profile("dev")을 추가하여 개발서버에서는 기존의 개발된 설정 파일을 사용
profile: prod로 진행시에 기존의 설정 대신 스프링 기본 설정으로 사용하도록 변경
기존의 isProd밑 isDev추가하여 dev, prod분기 생성
Summary by CodeRabbit
릴리스 노트
개선 사항
구성 변경
✏️ Tip: You can customize this high-level summary in your review settings.