260508_03_ENH: 트렌젝션 및 최대 연결 풀 설정 적용

This commit is contained in:
2026-05-08 15:38:01 +09:00
parent 727097f6bd
commit ad45d7fd7f
5 changed files with 19 additions and 4 deletions

View File

@@ -20,9 +20,10 @@ public class DataSourceConfig {
@Bean(name = "mainDataSource") @Bean(name = "mainDataSource")
@Primary @Primary
public DataSource mainDataSource(DataSourceProperties mainDataSourceProperties) { @ConfigurationProperties(prefix = "spring.datasource.hikari")
public HikariDataSource mainDataSource(DataSourceProperties mainDataSourceProperties) {
return mainDataSourceProperties.initializeDataSourceBuilder() return mainDataSourceProperties.initializeDataSourceBuilder()
.type(HikariDataSource.class) .type(HikariDataSource.class)
.build(); .build();
} }
} }

View File

@@ -12,6 +12,7 @@ import java.util.Map;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@@ -28,6 +29,7 @@ public class AdminService {
@Value("${kri.kfpa-comment-idkey-suffix:}") @Value("${kri.kfpa-comment-idkey-suffix:}")
private String kfpaCommentIdkeySuffix; private String kfpaCommentIdkeySuffix;
@Transactional
public boolean updateDivComment(RequestWriteDivCommentDto request) { public boolean updateDivComment(RequestWriteDivCommentDto request) {
String idkey = IDKEY_MAP.get(request.getDivId().toString()); String idkey = IDKEY_MAP.get(request.getDivId().toString());
if (idkey == null) { if (idkey == null) {

View File

@@ -11,9 +11,11 @@ import com.kri.kfpa.dash.entity.KonUserEntity;
import com.kri.kfpa.dash.mapper.KonUserMapper; import com.kri.kfpa.dash.mapper.KonUserMapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Transactional(readOnly = true)
public class AuthService { public class AuthService {
private final JwtService jwtService; private final JwtService jwtService;
private final KonUserMapper konUserMapper; private final KonUserMapper konUserMapper;

View File

@@ -21,9 +21,11 @@ import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Transactional(readOnly = true)
public class StatisticsService { public class StatisticsService {
private final DataMapper dataMapper; private final DataMapper dataMapper;

View File

@@ -7,9 +7,17 @@ spring:
name: kfpa-cx-dash-back name: kfpa-cx-dash-back
datasource: datasource:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://1.235.195.8:20022;databaseName=KON;encrypt=false url: jdbc:sqlserver://1.235.195.8:20022;databaseName=KON;encrypt=false;loginTimeout=5
username: kon username: kon
password: kon#51304 password: kon#51304
hikari:
pool-name: kfpa-dash-pool
maximum-pool-size: 5
minimum-idle: 1
idle-timeout: 30000
max-lifetime: 1800000
connection-timeout: 10000
leak-detection-threshold: 20000
profiles: profiles:
# 아무 설정 없을 때 기본으로 쓸 프로파일 # 아무 설정 없을 때 기본으로 쓸 프로파일
default: local default: local
@@ -53,4 +61,4 @@ kri:
redis: redis:
enabled: false # RedisQueueHelper 사용 시 true enabled: false # RedisQueueHelper 사용 시 true
scheduling: scheduling:
enabled: false # @Scheduled 사용 시 true enabled: false # @Scheduled 사용 시 true