2018年8月25日 星期六

Quartz 2.x 整合 SpringBoot 2.x


buildscript {
    ext {
        springBootVersion = '2.0.3.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}
    
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
    
repositories {
    mavenCentral()
}
    
ext {
    springVersion = '4.3.18.RELEASE'
    springBootVersion = '2.0.3.RELEASE'
    quartzVersion = '2.2.1'
}
    
dependencies {
    compile 'org.springframework.boot:spring-boot-starter'
    testCompile 'org.springframework.boot:spring-boot-starter-test'
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile group: 'org.springframework', name: 'spring-context-support', version: springVersion
    compile group: 'org.springframework', name: 'spring-tx', version: springVersion
    compile group: 'org.quartz-scheduler', name: 'quartz', version: quartzVersion
    compile group: 'org.quartz-scheduler', name: 'quartz-jobs', version: quartzVersion
}




@SpringBootApplication
@ComponentScan("annotation")
public class Library {
    public static void main(String[] args) {
        SpringApplication.run(Library.class, args);
    }
}

※@ComponentScan 的程式碼可看我的另一篇,最下面的 annotation

沒有留言:

張貼留言