Java Error - Scheduled

-1

I'm encountering the following error when trying to compile the image code. I created a project just to test the code, and this appears. I have not found similar error elsewhere, can anyone help me?

Followthecode:

packagetestet;importjava.time.LocalDateTime;@Component@EnableSchedulingpublicclassTesteT{privatefinallongSEGUNDO=1000;privatefinallongMINUTO=SEGUNDO*60;privatefinallongHORA=MINUTO*60;@Scheduled(cron="0 0 12 * * *")    
  public void verificaPorHora() {    
    System.out.println(LocalDateTime.now());
    // Código que realiza a consulta de fluxo de vendas
  }

  public static void main(String[] args) {
    // TODO code application logic here
  }
}
    
asked by anonymous 27.04.2018 / 13:48

1 answer

2

Hello,

The error refers to the annotation @Component , which was not imported in its TestT class.

To fix, use:

import org.springframework.stereotype.Component;

I think you'll have the same problem with @EnableScheduling

    
27.04.2018 / 15:02