Tabnine Logo
EnableScheduling.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.springframework.scheduling.annotation.EnableScheduling
constructor

Best Java code snippets using org.springframework.scheduling.annotation.EnableScheduling.<init> (Showing top 20 results out of 2,286)

origin: ityouknow/spring-boot-examples

@SpringBootApplication
@EnableScheduling
public class Application {

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

origin: qiurunze123/miaosha

@SpringBootApplication
@EnableScheduling
public class GeekQMainApplication {
origin: alibaba/nacos

/**
 * Hello world!
 *
 * @author xxc
 */
@EnableScheduling
@SpringBootApplication
public class NamingApp {

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

origin: alibaba/nacos

/**
 * Config main
 *
 * @author Nacos
 */
@EnableScheduling
@SpringBootApplication
public class Config {

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

origin: macrozheng/mall

@SpringBootApplication
@MapperScan({"com.macro.mall.mapper","com.macro.mall.portal.dao"})
@EnableScheduling
public class MallPortalApplication {

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

}

origin: linlinjava/litemall

@SpringBootApplication(scanBasePackages = {"org.linlinjava.litemall"})
@MapperScan("org.linlinjava.litemall.db.dao")
@EnableTransactionManagement
@EnableScheduling
public class Application {

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

}
origin: linlinjava/litemall

@SpringBootApplication(scanBasePackages = {"org.linlinjava.litemall.db", "org.linlinjava.litemall.core", "org.linlinjava.litemall.wx"})
@MapperScan("org.linlinjava.litemall.db.dao")
@EnableTransactionManagement
@EnableScheduling
public class Application {

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

}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class FixedRateTaskConfig_withInitialDelay {
  @Bean
  public AtomicInteger counter() {
    return new AtomicInteger();
  }
  @Scheduled(initialDelay = 1000, fixedRate = 100)
  public void task() {
    counter().incrementAndGet();
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class AspectConfig {
  @Bean
  public static AnnotationAwareAspectJAutoProxyCreator autoProxyCreator() {
    AnnotationAwareAspectJAutoProxyCreator apc = new AnnotationAwareAspectJAutoProxyCreator();
    apc.setProxyTargetClass(true);
    return apc;
  }
  @Bean
  public static MyAspect myAspect() {
    return new MyAspect();
  }
}
origin: alibaba/nacos

/**
 * @author nacos
 */
@SpringBootApplication(scanBasePackages = "com.alibaba.nacos")
@ServletComponentScan
@EnableScheduling
public class Nacos {

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

origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class FixedRateTaskConfig implements SchedulingConfigurer {
  @Override
  public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.addFixedRateTask(() -> {}, 100);
  }
  @Bean
  public AtomicInteger counter() {
    return new AtomicInteger();
  }
  @Scheduled(fixedRate = 10)
  public void task() {
    counter().incrementAndGet();
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class Config {
  @Bean
  public PlatformTransactionManager txManager() {
    return new CallCountingTransactionManager();
  }
  @Bean
  public PersistenceExceptionTranslator peTranslator() {
    return mock(PersistenceExceptionTranslator.class);
  }
  @Bean
  public static PersistenceExceptionTranslationPostProcessor peTranslationPostProcessor() {
    return new PersistenceExceptionTranslationPostProcessor();
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class SchedulingEnabled_withAmbiguousTaskSchedulers_butNoActualTasks {
  @Bean
  public TaskScheduler taskScheduler1() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler1");
    return scheduler;
  }
  @Bean
  public TaskScheduler taskScheduler2() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler2");
    return scheduler;
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class AmbiguousExplicitSchedulerConfig {
  @Bean
  public TaskScheduler taskScheduler1() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler1");
    return scheduler;
  }
  @Bean
  public TaskScheduler taskScheduler2() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler2");
    return scheduler;
  }
  @Scheduled(fixedRate = 10)
  public void task() {
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask {
  @Scheduled(fixedRate = 10L)
  public void task() {
  }
  @Bean
  public TaskScheduler taskScheduler1() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler1");
    return scheduler;
  }
  @Bean
  public TaskScheduler taskScheduler2() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler2");
    return scheduler;
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class ExplicitSchedulerConfig {
  String threadName;
  @Bean
  public TaskScheduler myTaskScheduler() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler-");
    return scheduler;
  }
  @Bean
  public AtomicInteger counter() {
    return new AtomicInteger();
  }
  @Scheduled(fixedRate = 10)
  public void task() {
    threadName = Thread.currentThread().getName();
    counter().incrementAndGet();
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class SchedulingEnabled_withTaskAddedVia_configureTasks implements SchedulingConfigurer {
  @Bean
  public ThreadAwareWorker worker() {
    return new ThreadAwareWorker();
  }
  @Bean
  public TaskScheduler taskScheduler() {
    return new ThreadPoolTaskScheduler();
  }
  @Override
  public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.setScheduler(taskScheduler());
    taskRegistrar.addFixedRateTask(new IntervalTask(
        new Runnable() {
          @Override
          public void run() {
            worker().executedByThread = Thread.currentThread().getName();
          }
        },
        10, 0));
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrar implements SchedulingConfigurer {
  @Scheduled(fixedRate = 10)
  public void task() {
    worker().executedByThread = Thread.currentThread().getName();
  }
  @Bean
  public ThreadAwareWorker worker() {
    return new ThreadAwareWorker();
  }
  @Override
  public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.setScheduler(taskScheduler2());
  }
  @Bean
  public TaskScheduler taskScheduler1() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler1-");
    return scheduler;
  }
  @Bean
  public TaskScheduler taskScheduler2() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler2-");
    return scheduler;
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute implements SchedulingConfigurer {
  @Scheduled(fixedRate = 10)
  public void task() {
    worker().executedByThread = Thread.currentThread().getName();
  }
  @Bean
  public ThreadAwareWorker worker() {
    return new ThreadAwareWorker();
  }
  @Bean
  public TaskScheduler taskScheduler1() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler1-");
    return scheduler;
  }
  @Bean
  public TaskScheduler taskScheduler2() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler2-");
    return scheduler;
  }
  @Override
  public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.setScheduler(taskScheduler2());
  }
}
origin: spring-projects/spring-framework

@Configuration
@EnableScheduling
static class ExplicitScheduledTaskRegistrarConfig implements SchedulingConfigurer {
  String threadName;
  @Bean
  public TaskScheduler taskScheduler1() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler1");
    return scheduler;
  }
  @Bean
  public TaskScheduler taskScheduler2() {
    ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
    scheduler.setThreadNamePrefix("explicitScheduler2");
    return scheduler;
  }
  @Bean
  public AtomicInteger counter() {
    return new AtomicInteger();
  }
  @Scheduled(fixedRate = 10)
  public void task() {
    threadName = Thread.currentThread().getName();
    counter().incrementAndGet();
  }
  @Override
  public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
    taskRegistrar.setScheduler(taskScheduler1());
  }
}
org.springframework.scheduling.annotationEnableScheduling<init>

Popular methods of EnableScheduling

    Popular in Java

    • Updating database using SQL prepared statement
    • getSharedPreferences (Context)
    • orElseThrow (Optional)
      Return the contained value, if present, otherwise throw an exception to be created by the provided s
    • putExtra (Intent)
    • Component (java.awt)
      A component is an object having a graphical representation that can be displayed on the screen and t
    • File (java.io)
      An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
    • Dictionary (java.util)
      Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
    • NoSuchElementException (java.util)
      Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
    • TimeZone (java.util)
      TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
    • DateTimeFormat (org.joda.time.format)
      Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
    • From CI to AI: The AI layer in your organization
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now