Merge pull request '배치 2008 설정 수정(yml, xml. java)' (#95) from feature/cha into dev
Reviewed-on: #95
This commit is contained in:
commit
59918fe25c
@ -1,12 +1,11 @@
|
|||||||
package com.interplug.qcast.config.batch;
|
package com.interplug.qcast.config.batch;
|
||||||
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||||
import org.springframework.batch.core.repository.JobRepository;
|
import org.springframework.batch.core.repository.JobRepository;
|
||||||
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
|
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
|
||||||
import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueIncrementerFactory;
|
|
||||||
import org.springframework.batch.support.DatabaseType;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
@ -15,35 +14,39 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spring Batch Configuration for SQL Server without sequence support
|
* Spring Batch configuration for SQL Server 2008 without sequence support.
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableBatchProcessing(modular = false)
|
@EnableBatchProcessing
|
||||||
public class BatchConfiguration {
|
public class BatchConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom JobRepository that uses table-based ID generation instead of sequences
|
* Configuring JobRepository for SQL Server 2008.
|
||||||
|
* Uses table-based ID generation instead of sequences.
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
public JobRepository jobRepository(DataSource dataSource,
|
public JobRepository jobRepository(DataSource dataSource, PlatformTransactionManager transactionManager) throws Exception {
|
||||||
PlatformTransactionManager transactionManager) throws Exception {
|
|
||||||
JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
|
JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
|
||||||
factory.setDataSource(dataSource);
|
factory.setDataSource(dataSource);
|
||||||
factory.setTransactionManager(transactionManager);
|
factory.setTransactionManager(transactionManager);
|
||||||
factory.setDatabaseType("sqlserver");
|
|
||||||
factory.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED");
|
|
||||||
|
|
||||||
// 시퀀스 없이 max(id)+1 방식으로 증가
|
// Use TABLE_PREFIX to map to Spring Batch tables
|
||||||
factory.setIncrementerFactory(new DefaultDataFieldMaxValueIncrementerFactory(dataSource));
|
factory.setTablePrefix("BATCH_");
|
||||||
|
|
||||||
|
// Isolation level setting for SQL Server
|
||||||
|
factory.setIsolationLevelForCreate("ISOLATION_SERIALIZABLE");
|
||||||
|
|
||||||
|
// Set to "SQLSERVER" for Spring Batch compatibility
|
||||||
|
factory.setDatabaseType("SQLSERVER");
|
||||||
|
|
||||||
|
// Finalize factory setup
|
||||||
factory.afterPropertiesSet();
|
factory.afterPropertiesSet();
|
||||||
return factory.getObject();
|
return factory.getObject();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TaskExecutor for async batch processing
|
* TaskExecutor for batch processing (multithreading support).
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public TaskExecutor batchTaskExecutor() {
|
public TaskExecutor batchTaskExecutor() {
|
||||||
@ -51,7 +54,7 @@ public class BatchConfiguration {
|
|||||||
executor.setCorePoolSize(5);
|
executor.setCorePoolSize(5);
|
||||||
executor.setMaxPoolSize(10);
|
executor.setMaxPoolSize(10);
|
||||||
executor.setQueueCapacity(25);
|
executor.setQueueCapacity(25);
|
||||||
executor.setThreadNamePrefix("batch-");
|
executor.setThreadNamePrefix("batch-thread-");
|
||||||
executor.initialize();
|
executor.initialize();
|
||||||
return executor;
|
return executor;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ spring:
|
|||||||
schema:
|
schema:
|
||||||
job:
|
job:
|
||||||
names: ${job.name:NONE}
|
names: ${job.name:NONE}
|
||||||
enabled: true
|
enabled: false
|
||||||
profiles:
|
profiles:
|
||||||
scheduler: Y
|
scheduler: Y
|
||||||
batch:
|
batch:
|
||||||
|
|||||||
@ -36,4 +36,14 @@
|
|||||||
<appender-ref ref="FILE"/>
|
<appender-ref ref="FILE"/>
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
|
<!-- Spring Batch 로깅 레벨 설정 -->
|
||||||
|
<logger name="org.springframework.batch" level="DEBUG"/>
|
||||||
|
|
||||||
|
<!-- JdbcTemplate 로깅 레벨 설정 -->
|
||||||
|
<logger name="org.springframework.jdbc.core.JdbcTemplate" level="DEBUG"/>
|
||||||
|
|
||||||
|
<!-- Hibernate SQL 로깅을 활성화하려면 (선택 사항) -->
|
||||||
|
<logger name="org.hibernate.SQL" level="DEBUG"/>
|
||||||
|
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE"/>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
Loading…
x
Reference in New Issue
Block a user