All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gccloud.starter.plugins.quartz.server.GcStarterPluginsQuartzServerApplication Maven / Gradle / Ivy

There is a newer version: 1.2.4.2024062001.RELEASE
Show newest version
package com.gccloud.starter.plugins.quartz.server;

import com.gccloud.starter.common.constant.GlobalConst;
import com.gccloud.starter.core.mp.meta.EnableStarterMeta;
import com.gccloud.starter.plugins.quartz.service.entity.SysJobEntity;
import com.gccloud.starter.plugins.quartz.service.service.ISysJobService;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.concurrent.TimeUnit;

@EnableStarterMeta
@EnableSwagger2
@SpringBootApplication(scanBasePackages = {GlobalConst.ScanPackage.BASE_COMPONENT})
@MapperScan({GlobalConst.ScanPackage.BASE_DAO})
@EnableScheduling
@EnableCaching
@Slf4j
public class GcStarterPluginsQuartzServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(GcStarterPluginsQuartzServerApplication.class, args);
    }

    @Autowired
    private ISysJobService jobService;

    //@PostConstruct
    public void init() {
        new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(15);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            SysJobEntity sysJobEntity = new SysJobEntity();
            sysJobEntity.setStatus(GlobalConst.Schedule.Status.NORMAL);
            sysJobEntity.setBeanName("springBeanJob");
            sysJobEntity.setCronExpression("0/10 * * * * ?");
            sysJobEntity.setMethodName("noParam");
            sysJobEntity.setType(GlobalConst.Schedule.Type.SPRING_BEAN);
            jobService.add(sysJobEntity);
        }).start();

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy