Spring Batch ํ์ต๊ฒธ ์ํ์ ๋ง๋ค์ด๋ณด๊ณ ์์ต๋๋ค.--์๋๋ ์คํ๋ง ์ค์ผ์ค๋ฌ ๋๋ ์ธ๋ถ ํธ์ถ์ ์ํด ๋์ํ ์ ์๋๋ก ๊ตฌํํด๋ณด๋ ค ํฉ๋๋ค.์ดํ๋ฆฌ์ผ์ด์ ๊ตฌ๋์ ์๋์ผ๋ก JOB์ด ์คํ๋๋๋กํ๋ spring.batch.job.enabled ์์ฑ์ด true ์ผ๋๋ ๊ตฌ๋์ ์ ์์ ์ผ๋ก ๋์ํ๊ณ ์๋๋ฐ,spring.batch.job.enabled ๊ฐ์ false ๋ก ๋ณ๊ฒฝํ๊ณ JobLauncher๋ฅผ ์ด์ฉํด ์ง์ JOB์ ์คํํ๋ คํ๋ฉด ์๋์ ๊ฐ์ด ์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค.์ค์ ํ์ผ:spring:ย jpa:ย ย generate-ddl: trueย ย hibernate:ย ย ย ddl-auto: create-dropย ย dialect: org.hibernate.dialect.H2Dialectย datasource:ย ย url: jdbc:h2:mem:b;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSEย ย username: saย ย password:ย ย driverClassName: org.h2.Driverย ย initialize: trueย h2:ย ย console:ย ย ย enabled: trueย ย ย path: ย /h2ย batch:ย ย job:ย ย ย enabled: falseJava Code :@Component@Slf4jpublic class TestComponent{ย ย @Autowiredย ย JobLauncher jobLauncher;ย ย @Autowiredย ย ExBatch exBatch;ย ย @PostConstructย ย public void init(){try{ย ย ย ย ย ย jobLauncher.run(exBatch.job(), new JobParameters());ย ย ย ย }catch (Exception e){ย ย ย ย ย ย log.error(e.getMessage());ย ย ย ย }ย ย }}๋ก๊ทธ :ย2017-06-07 18:26:48.730 ย INFO 21868 --- [ ย ย ย ย ย main] o.s.jdbc.support.SQLErrorCodesFactory ย ย : SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]2017-06-07 18:26:48.734 ERROR 21868 --- [ ย ย ย ย ย main] com.wonzopein.service.DefaultService ย ย : PreparedStatementCallback; bad SQL grammar [SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?]; nested exception is org.h2.jdbc.JdbcSQLException: Table "BATCH_JOB_INSTANCE" not found; SQL statement:SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ? [42102-194]ํ ์ด๋ธ์ ์ฐพ์ ์ ์๋ค๋ ๋ฉ์์ง์ธ๋ฐ, ์ค์ ๋ก ํ ์ด๋ธ์ ์์ฑ๋์ด ์๋ ์ํ๋ค์.๋น์ทํ ๊ฒฝ์ฐ๋ผ๋ ์์ผ์ ๋ถ ๊ณต์ ํด์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
์ด ๋ฉ์ผ์ Google ๊ทธ๋ฃน์ค 'Korea Spring User Group Q&A' ๊ทธ๋ฃน์ ๊ฐ์ ํ ๋ถ๋ค์๊ฒ ์ ์ก๋๋ ๋ฉ์์ง์ ๋๋ค.
์ด ๊ทธ๋ฃน์์ ํํดํ๊ณ ๋ ์ด์ ์ด๋ฉ์ผ์ ๋ฐ์ง ์์ผ๋ ค๋ฉด ksug+unsubscribe@googlegroups.com์ ์ด๋ฉ์ผ์ ๋ณด๋ด์ธ์.
https://groups.google.com/group/ksug์์ ์ด ๊ทธ๋ฃน์ ๋ฐฉ๋ฌธํ์ธ์.
์น์์ ์ด ํ ๋ก ์ ๋ณด๋ ค๋ฉด https://groups.google.com/d/msgid/ksug/b6ae7650-02a7-43bb-8389-44cf5612bb56%40googlegroups.com์(๋ฅผ) ๋ฐฉ๋ฌธํ์ธ์.
๋ ๋ง์ ์ต์ ์ ๋ณด๋ ค๋ฉด https://groups.google.com/d/optout์(๋ฅผ) ๋ฐฉ๋ฌธํ์ธ์.
@Configuration
@EnableBatchProcessing
public class AJobConfiguration extends DefaultBatchConfigurer {
@Override
protected JobRepository createJobRepository() throws Exception {
MapJobRepositoryFactoryBean factory =
new MapJobRepositoryFactoryBean();
factory.afterPropertiesSet();
return (JobRepository) factory.getObject();
}
ํน์ ๋์๋ฌธ์ ๊ตฌ๋ถํ๊ฒ ์ค์ ๋์ด์์ผ์ ๊ฐ์?
์ด ๊ทธ๋ฃน์์ ํํดํ๊ณ ๋ ์ด์ ์ด๋ฉ์ผ์ ๋ฐ์ง ์์ผ๋ ค๋ฉด ksug+uns...@googlegroups.com์ ์ด๋ฉ์ผ์ ๋ณด๋ด์ธ์.