Closed
Description
The Spring boot configuration I'm using is
@SpringBootApplication
@EnableScheduling
public class Application {
public static void main(final String[] args) { SpringApplication.run(Application.class, args);}
}
In configuration there's a bean
@Component
public class MyBeanWithScheduledAnnotation {
@Scheduled(fixedRateString = '#{fixedRate}')
public void myJob() {
....
}
}
If I use this bean with @SpyBean
in my SpringBootTest
, the scheduled job does not execute. The test code looks like this:
@RunWith(SpringRunner.class)
@SpringBootTest
public class Test
@SpyBean
MyBeanWithScheduledAnnotation bean
...
pom.xml contains only two dependencies spring-boot-starter-web
and spring-boot-starter-test