Skip to content

ClasspathXmlApplicationContext cannot be closed twice [SPR-13425] #18004

Closed
@spring-projects-issues

Description

@spring-projects-issues

Eric Vigeant opened SPR-13425 and commented

Here is some simple code that will show the pattern:

ClassPathXmlApplicationContext ctx = ...

ctx.refresh(); // This works as expected
ctx.close(); // This closes the context correctly
ctx.refresh(); // This restarts the context properly
ctx.close(); // This does NOT close the context

I traced it down to the "closed" field in AbstractApplicationContext, it is initialized to false, it is set to true when closing, but it is never set again to false after it is restarted. This causes the doClose() method to do nothing.


Affects: 4.1.7, 4.2 GA

Issue Links:

Referenced from: commits 811de8e, 57125c0

Backported to: 4.1.8

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions