Skip to content

@Scheduled no longer works in case of multiple proxied target classes implementing the same interface [SPR-12709] #17306

Closed
@spring-projects-issues

Description

@spring-projects-issues

Trent Summerfield opened SPR-12709 and commented

We had a number of @Scheduled tasks stop firing after upgrading spring 3.2.x. I have tracked down the problem to changes introduced by #16803

We have a point cut set as such

@Pointcut("execution(* com.example.Processor.process())")}}

where Processor is a simple interface

public interface Processor {
    void process();
}

The implementing class looks like

@Component
public class ProcessorImpl implements Processor {

    @Override
    @Scheduled(cron = "*/2 * * * * *")
    public void process() {
        System.out.println("It works!");
    }
}

This works as expected in 3.2.11, printing "It works!" every 2 seconds. However the scheduled task fails to fire since 3.2.12. I have tested this with aspectj versions 1.7.4 and 1.8.5 and both fail to work.

I have confirmed that reverting commit 37da70629f68b07d83d5c57abb74cecb7ecb358b, introduced by #16803, fixes this problem.


Affects: 3.2.12, 3.2.13

Issue Links:

Referenced from: commits 1273c90, 3b8d878, f8a8ecd

Backported to: 3.2.14

1 votes, 7 watchers

Metadata

Metadata

Assignees

Labels

status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions