인프런 커뮤니티 질문&답변

박찬양님의 프로필 이미지

작성한 질문수

자바 스프링부트 활용 웹개발 실무용

E14 scheduler / cron 설정

logger.info 질문입니다

작성

·

359

0

import를 잘못해서 오류가나는건지

빨간줄이 지워지질않네요 ExampleScheduler

import 부분좀 알수있을까요 컨트롤 +o 버튼을눌러서 자동으로입력하니 logger.info 중 info에서 빨간줄이 사라지질않아요 ㅠ

 

 

답변 1

0

박찬양님의 프로필 이미지
박찬양
질문자

kr.co.songjava.configuration.GlobalConfig[init:35:INFO] - init

org.springframework.boot.SpringApplication[reportFailure:856:ERROR] - Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exampleScheduler' defined in file [D:\dev\spring\songjava_std\example-spring\target\classes\kr\co\songjava\scheduler\ExampleScheduler.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Encountered invalid @Scheduled method 'schedule1': Cron expression must consist of 6 fields (found 1 in "*/5*****")

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:617)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)

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:944)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:923)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)

at kr.co.songjava.ExampleSpringApplication.main(ExampleSpringApplication.java:12)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.base/java.lang.reflect.Method.invoke(Method.java:568)

at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)

Caused by: java.lang.IllegalStateException: Encountered invalid @Scheduled method 'schedule1': Cron expression must consist of 6 fields (found 1 in "*/5*****")

at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.processScheduled(ScheduledAnnotationBeanPostProcessor.java:511)

at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.lambda$null$1(ScheduledAnnotationBeanPostProcessor.java:374)

at java.base/java.lang.Iterable.forEach(Iterable.java:75)

at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.lambda$postProcessAfterInitialization$2(ScheduledAnnotationBeanPostProcessor.java:374)

at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)

at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.postProcessAfterInitialization(ScheduledAnnotationBeanPostProcessor.java:373)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:444)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609)

... 21 common frames omitted

빨간줄안나오게 임포트하면 또이런창도나오네요.. ㅠ