2014-04-25 2 views
2

현재 스프링을 가르치고 있습니다. 현재 예약 된 작업이 있으며 다음 코드는 예약 된 작업을 실행하지 않습니다.봄 예약 된 작업이 실행되지 않음

나는 스프링 컨텍스트를 설정하는 것과 관련이 있다고 믿는다. 그러나 그것은 단지 추측 일 뿐이다. 나는 스프링을 배우려고 노력하고있다. 어리석은 while 루프를 변명해라.

Application.java :

package hello; 

import org.springframework.context.annotation.AnnotationConfigApplicationContext; 

public class Application { 

    public static void main(String[] args) throws Exception { 
     AnnotationConfigApplicationContext rootContext = 
         new AnnotationConfigApplicationContext(); 

     rootContext.register(RootContextConfiguration.class); 
     rootContext.refresh(); 

     while(rootContext != null) { 
      try { 
       Thread.sleep(2500); 
      } catch(InterruptedException ex) { 
       Thread.currentThread().interrupt(); 
      } 

      System.out.println("Loop\n"); 
     } 

     rootContext.close(); 
    } 
} 

RootContextConfiguration.java :

package hello; 

import java.util.concurrent.Executor; 

import org.springframework.context.annotation.AdviceMode; 
import org.springframework.context.annotation.Bean; 
import org.springframework.context.annotation.ComponentScan; 
import org.springframework.context.annotation.Configuration; 
import org.springframework.core.Ordered; 
import org.springframework.scheduling.TaskScheduler; 
import org.springframework.scheduling.annotation.AsyncConfigurer; 
import org.springframework.scheduling.annotation.EnableAsync; 
import org.springframework.scheduling.annotation.EnableScheduling; 
import org.springframework.scheduling.annotation.SchedulingConfigurer; 
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; 
import org.springframework.scheduling.config.ScheduledTaskRegistrar; 

@Configuration 
@EnableScheduling 
@EnableAsync(
     mode = AdviceMode.PROXY, proxyTargetClass = false, 
     order = Ordered.HIGHEST_PRECEDENCE 
) 
@ComponentScan(
     basePackages = "hello" 
) 
public class RootContextConfiguration implements 
AsyncConfigurer, SchedulingConfigurer { 
    @Bean 
    public ThreadPoolTaskScheduler taskScheduler() 
    { 
     ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); 
     scheduler.setPoolSize(20); 
     scheduler.setThreadNamePrefix("task-"); 
     scheduler.setAwaitTerminationSeconds(60); 
     scheduler.setWaitForTasksToCompleteOnShutdown(true); 
     return scheduler; 
    } 

    @Override 
    public Executor getAsyncExecutor() 
    { 
     Executor executor = this.taskScheduler(); 
     return executor; 
    } 

    @Override 
    public void configureTasks(ScheduledTaskRegistrar registrar) 
    { 
     TaskScheduler scheduler = this.taskScheduler(); 
     registrar.setTaskScheduler(scheduler); 
    } 
} 

ScheduledTasks.java :

package hello; 

import java.text.SimpleDateFormat; 
import java.util.Date; 
import org.springframework.scheduling.annotation.EnableScheduling; 
import org.springframework.scheduling.annotation.Scheduled; 

@EnableScheduling 
public class ScheduledTasks { 

    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); 

    @Scheduled(fixedRate = 5000) 
    public void reportCurrentTime() { 
     System.out.println("The time is now " + dateFormat.format(new Date())); 
    } 
} 

의 pom.xml :

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>org.springframework</groupId> 
    <artifactId>gs-scheduling-tasks</artifactId> 
    <version>0.1.0</version> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.0.2.RELEASE</version> 
    </parent> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter</artifactId> 
     </dependency> 
    </dependencies> 

    <properties> 
     <start-class>hello.Application</start-class> 
    </properties> 

    <build> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
      </plugin> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 

    <repositories> 
     <repository> 
      <id>spring-snapshots</id> 
      <name>Spring Snapshots</name> 
      <url>http://repo.spring.io/libs-snapshot</url> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>spring-snapshots</id> 
      <name>Spring Snapshots</name> 
      <url>http://repo.spring.io/libs-snapshot</url> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </pluginRepository> 
    </pluginRepositories> 
</project> 
,691 363,210

여기 내 단말기에서 볼 수있는 작업은 다음과 같습니다

12:32:36.533 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence 
12:32:36.541 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence 
12:32:36.542 [main] DEBUG o.s.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 
12:32:36.657 [main] INFO o.s.c.a.AnnotationConfigApplicationContext - Refreshing org.spring[email protected]7a46a697: startup date [Fri Apr 25 12:32:36 PDT 2014]; root of context hierarchy 
12:32:36.663 [main] DEBUG o.s.c.a.AnnotationConfigApplicationContext - Bean factory for org.spring[email protected]7a46a697: org.springframework.beans.factory.support[email protected]: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,rootContextConfiguration]; root of factory hierarchy 
12:32:36.691 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 
12:32:36.692 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 
12:32:36.725 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' to allow for resolving potential circular references 
12:32:36.728 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 
12:32:36.789 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence 
12:32:36.790 [main] DEBUG o.s.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence 
12:32:36.791 [main] DEBUG o.s.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 
12:32:36.799 [main] DEBUG o.s.c.i.s.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [/Users/cthielen/src/spring/scheduled-tasks/target/classes/hello] 
12:32:36.799 [main] DEBUG o.s.c.i.s.PathMatchingResourcePatternResolver - Searching directory [/Users/cthielen/src/spring/scheduled-tasks/target/classes/hello] for files matching pattern [/Users/cthielen/src/spring/scheduled-tasks/target/classes/hello/**/*.class] 
12:32:36.803 [main] DEBUG o.s.c.i.s.PathMatchingResourcePatternResolver - Resolved location pattern [classpath*:hello/**/*.class] to resources [file [/Users/cthielen/src/spring/scheduled-tasks/target/classes/hello/Application.class], file [/Users/cthielen/src/spring/scheduled-tasks/target/classes/hello/RootContextConfiguration.class], file [/Users/cthielen/src/spring/scheduled-tasks/target/classes/hello/ScheduledTasks.class]] 
12:32:36.941 [main] DEBUG o.s.c.a.ConfigurationClassBeanDefinitionReader - Registered bean definition for imported @Configuration class org.springframework.scheduling.annotation.SchedulingConfiguration 
12:32:36.944 [main] DEBUG o.s.c.a.ConfigurationClassBeanDefinitionReader - Registering bean definition for @Bean method org.springframework.scheduling.annotation.SchedulingConfiguration.org.springframework.context.annotation.internalScheduledAnnotationProcessor() 
12:32:36.945 [main] DEBUG o.s.c.a.ConfigurationClassBeanDefinitionReader - Registered bean definition for imported @Configuration class org.springframework.scheduling.annotation.ProxyAsyncConfiguration 
12:32:36.946 [main] DEBUG o.s.c.a.ConfigurationClassBeanDefinitionReader - Registering bean definition for @Bean method org.springframework.scheduling.annotation.ProxyAsyncConfiguration.org.springframework.context.annotation.internalAsyncAnnotationProcessor() 
12:32:36.950 [main] DEBUG o.s.c.a.ConfigurationClassBeanDefinitionReader - Registering bean definition for @Bean method hello.RootContextConfiguration.taskScheduler() 
12:32:37.056 [main] DEBUG o.s.c.a.ConfigurationClassEnhancer - Successfully enhanced hello.RootContextConfiguration; enhanced class name is: hello.RootContextConfiguration$$EnhancerBySpringCGLIB$$723fae61 
12:32:37.056 [main] DEBUG o.s.c.a.ConfigurationClassPostProcessor - Replacing bean definition 'rootContextConfiguration' existing class name 'hello.RootContextConfiguration' with enhanced class name 'hello.RootContextConfiguration$$EnhancerBySpringCGLIB$$723fae61' 
12:32:37.060 [main] DEBUG o.s.c.a.ConfigurationClassEnhancer - Successfully enhanced org.springframework.scheduling.annotation.SchedulingConfiguration; enhanced class name is: org.springframework.scheduling.annotation.SchedulingConfiguration$$EnhancerBySpringCGLIB$$4cc1c8d2 
12:32:37.061 [main] DEBUG o.s.c.a.ConfigurationClassPostProcessor - Replacing bean definition 'org.springframework.scheduling.annotation.SchedulingConfiguration' existing class name 'org.springframework.scheduling.annotation.SchedulingConfiguration' with enhanced class name 'org.springframework.scheduling.annotation.SchedulingConfiguration$$EnhancerBySpringCGLIB$$4cc1c8d2' 
12:32:37.071 [main] DEBUG o.s.c.a.ConfigurationClassEnhancer - Successfully enhanced org.springframework.scheduling.annotation.ProxyAsyncConfiguration; enhanced class name is: org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$18e9d438 
12:32:37.072 [main] DEBUG o.s.c.a.ConfigurationClassPostProcessor - Replacing bean definition 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' existing class name 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' with enhanced class name 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$18e9d438' 
12:32:37.086 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 
12:32:37.088 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 
12:32:37.089 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references 
12:32:37.090 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 
12:32:37.090 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 
12:32:37.090 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 
12:32:37.091 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references 
12:32:37.091 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 
12:32:37.091 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 
12:32:37.092 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 
12:32:37.096 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references 
12:32:37.098 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 
12:32:37.098 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' 
12:32:37.098 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' 
12:32:37.099 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' to allow for resolving potential circular references 
12:32:37.099 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' 
12:32:37.099 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' 
12:32:37.100 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' 
12:32:37.100 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' to allow for resolving potential circular references 
12:32:37.100 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' 
12:32:37.102 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalScheduledAnnotationProcessor' 
12:32:37.102 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalScheduledAnnotationProcessor' 
12:32:37.105 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' 
12:32:37.105 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' 
12:32:37.122 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' to allow for resolving potential circular references 
12:32:37.168 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' of type [class org.springframework.scheduling.annotation.SchedulingConfiguration$$EnhancerBySpringCGLIB$$4cc1c8d2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
12:32:37.168 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' 
12:32:37.253 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalScheduledAnnotationProcessor' to allow for resolving potential circular references 
12:32:37.258 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalScheduledAnnotationProcessor' 
12:32:37.259 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' 
12:32:37.259 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' 
12:32:37.259 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' 
12:32:37.259 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' 
12:32:37.265 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Registered injected element on class [org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$18e9d438]: AutowiredMethodElement for void org.springframework.scheduling.annotation.AbstractAsyncConfiguration.setConfigurers(java.util.Collection) 
12:32:37.265 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' to allow for resolving potential circular references 
12:32:37.268 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Processing injected method of bean 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration': AutowiredMethodElement for void org.springframework.scheduling.annotation.AbstractAsyncConfiguration.setConfigurers(java.util.Collection) 
12:32:37.273 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'rootContextConfiguration' 
12:32:37.273 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'rootContextConfiguration' 
12:32:37.275 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'rootContextConfiguration' to allow for resolving potential circular references 
12:32:37.278 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'rootContextConfiguration' of type [class hello.RootContextConfiguration$$EnhancerBySpringCGLIB$$723fae61] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
12:32:37.279 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'rootContextConfiguration' 
12:32:37.290 [main] DEBUG o.s.b.f.a.AutowiredAnnotationBeanPostProcessor - Autowiring by type from bean name 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' to bean named 'rootContextConfiguration' 
12:32:37.291 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'taskScheduler' 
12:32:37.291 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'taskScheduler' 
12:32:37.291 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'rootContextConfiguration' 
12:32:37.308 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'taskScheduler' to allow for resolving potential circular references 
12:32:37.336 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Invoking afterPropertiesSet() on bean with name 'taskScheduler' 
12:32:37.338 [main] INFO o.s.s.c.ThreadPoolTaskScheduler - Initializing ExecutorService 'taskScheduler' 
12:32:37.342 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'taskScheduler' of type [class org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
12:32:37.342 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'taskScheduler' 
12:32:37.342 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' 
12:32:37.345 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' of type [class org.springframework.scheduling.annotation.ProxyAsyncConfiguration$$EnhancerBySpringCGLIB$$18e9d438] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
12:32:37.345 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' 
12:32:37.385 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Eagerly caching bean 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' to allow for resolving potential circular references 
12:32:37.413 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' 
12:32:37.435 [main] DEBUG o.s.c.a.AnnotationConfigApplicationContext - Unable to locate MessageSource with name 'messageSource': using default [[email protected]f59f] 
12:32:37.440 [main] DEBUG o.s.c.a.AnnotationConfigApplicationContext - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.[email protected]12d4bf7e] 
12:32:37.454 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Pre-instantiating singletons in org.s[email protected]2038ae61: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,rootContextConfiguration,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,org.springframework.scheduling.annotation.SchedulingConfiguration,org.springframework.context.annotation.internalScheduledAnnotationProcessor,org.springframework.scheduling.annotation.ProxyAsyncConfiguration,org.springframework.context.annotation.internalAsyncAnnotationProcessor,taskScheduler]; root of factory hierarchy 
12:32:37.455 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor' 
12:32:37.455 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 
12:32:37.455 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' 
12:32:37.456 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 
12:32:37.459 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'rootContextConfiguration' 
12:32:37.460 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor' 
12:32:37.461 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor' 
12:32:37.461 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.scheduling.annotation.SchedulingConfiguration' 
12:32:37.461 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalScheduledAnnotationProcessor' 
12:32:37.461 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration' 
12:32:37.461 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' 
12:32:37.461 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'taskScheduler' 
12:32:37.463 [main] DEBUG o.s.c.a.AnnotationConfigApplicationContext - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [[email protected]28854b] 
12:32:37.463 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor' 
12:32:37.464 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalScheduledAnnotationProcessor' 
12:32:37.465 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'rootContextConfiguration' 
12:32:37.465 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'taskScheduler' 
12:32:37.481 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties] 
12:32:37.482 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment] 
12:32:37.482 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null] 
Loop 

Loop 

Loop 

Loop 

는, 2.5s 및 인쇄에 대한 잠자는 명확하게하기 위해 "루프"예약 된 작업 화재 있는지 확인하기 위해 실행되는 응용 프로그램을 유지하기 위해 단지가있다.

내가 찾고있는 것은 발사 시간을 인쇄하는 예약 된 작업입니다. 그렇지 않습니다.

미리 도움을 주셔서 감사합니다.

답변

16

ScheduledTasks 콩이 없습니다. 수업에 @Component (또는 해당 전문 분야)으로 주석을 달거나 @Configuration 클래스에 @Bean 방법을 선언하십시오.


@EnableScheduling하지 예약 된 동작을 가지고있는 클래스에, @Configuration 클래스에 속한다. ScheduledTasks에서 제거 할 수 있습니다.

관련 문제