springboot的Scheduled定时器不工作

问题情况

使用springboot,使用注解方式启动定时器进行业务调度。

在入口类中加了注解如下:

package org.test.xyz;

@SpringBootApplication
@EnableScheduling
@ComponentScan(basePackages = {"org.test.abc"})
public class Test
{
    public static void main(String[] args)
    {
        SpringApplication.run(Test.class, args);
    }
}
View Code

定时器类如下:

package org.test.xyz;

@Component
public class Timer
{
    public static void main(String[] args)
    {
        SpringApplication.run(Test.class, args);
    }
}

猜你喜欢

转载自www.cnblogs.com/willdoop/p/9567139.html