에러

[Spring Batch] java.lang.IllegalStateException: ItemWriter must be provided 에러

뚜키 💻 2022. 12. 15. 00:34
반응형

[Spring Batch] java.lang.IllegalStateException: ItemWriter must be provided 에러

 

java.lang.IllegalStateException: ItemWriter must be provided
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at kr.co.gccompany.notification.batch.BatchApplication.main(BatchApplication.java:12)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.batch.core.Job]: Factory method

 

 

✔ 현상

배치를 만들던중 reader까지 만들었고 잘 읽어오는지 확인해봐야징~~ 하면서 배치를 돌렸는데 해당 오류가 나타났다.

 

 

✔ 원인

ItemReader만있고 ItemWriter가 없어서 발생한 오류

검색해보니 Spring batch 4.몇버전부터 ItemWriter가 필수가 된듯하다.

 

 

 

✔ 해결

ItemWriter를 만들어서 배치를 돌려보니 오류가 사라졌다. 

 

 

 

 

 

📍 참고링크

https://stackoverflow.com/questions/59394736/java-lang-illegalstateexception-itemwriter-must-be-provided-after-updating-spri
반응형