Skip to content

Invocation of @Async service fails [SPR-10636] #15264

@spring-projects-issues

Description

@spring-projects-issues

Dimitar Makariev opened SPR-10636 and commented

The described feature works on 3.2.1.RELEASE, fails on 3.2.2.RELEASE and 3.2.3.RELEASE.

Trying to change object instance passed to service defined as @Async :

@Service
public class PopulateService {

    private final List<Person> persons;
    private final AsyncService asyncService;

    @Autowired
    public PopulateService(AsyncService asyncService) {
        persons = new ArrayList<Person>();
        this.asyncService = asyncService;
    }

    public void populatePersons(int numberOfPersons) {
        asyncService.populatePersons(persons, numberOfPersons);
    }

    public List<Person> getPersons() {
        return persons;
    }
}

@Service
public class AsyncService {

    @Async
    public void populatePersons(List<Person> persons, int numberOfPersons) {
        for (int i = 0; i < numberOfPersons; i++) {
            persons.add(new Person("first " + i, "last " + i));
        }
    }
} 

Affects: 3.2.2, 3.2.3

Attachments:

Issue Links:

Referenced from: commits 3562cd7, b6c54c3

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions