Skip to content

AbstractApplicationContext.isRunning throws IllegalStateException when called too early [SPR-13667] #18242

@spring-projects-issues

Description

@spring-projects-issues

David Hay opened SPR-13667 and commented

AbstractApplicationContext's implementation of isRunning() looks like this:

public boolean isRunning() {
     return this.getLifecycleProcessor().isRunning();
}

If this method is called before the lifecycle processor has been initialized, an IllegalStateException is thrown.

It seems like the correct behavior here would be to return "false" if the lifecycle processor hasn't been initialized. If the lifecycle processor is uninitialized, the answer to the question "are you running" is "no", not "illegal state".


Affects: 3.2.15, 4.1.7

Referenced from: commits 03585f2, 5d6aab3, e56c11c

Backported to: 4.1.9, 3.2.16

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)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