Ramesh Kotha
Ramesh Kotha

Reputation: 8322

@Scheduled annotation is not working properly?

i am using spring annotaions with <task:annotation-driven/>

@Scheduled(fixedDelay=100)
    public void shout(){
        System.out.println("hello");
    }

this is printing only 9 times, but i want it to print infinitely.

Upvotes: 0

Views: 835

Answers (1)

Ralph
Ralph

Reputation: 120881

As far as I understand you and the behavior, then the problem seams to be that the containing Application, Test, whatever just ends.

A Spring Scheduler does not hold the application open. If the spring context ends, because the application ends, then the timer also stops.

Upvotes: 1

Related Questions