Skip to content

Deprecate SpringApplication#refresh(ApplicationContext) and provide SpringApplication#refresh(ConfigurableApplicationContext) as a replacement #18519

@justmehyp

Description

@justmehyp

The method SpringApplication#refresh is only called by SpringApplication#refreshContext(ConfigurableApplicationContext).
So the application context instance passed to SpringApplication#refresh will always be a subclass of ConfigurableApplicationContext, which has a method 'refresh'.
No need to assert that using Assert.isInstanceOf(AbstractApplicationContext.class, applicationContext);.

It could be simplified like this:

protected void refresh(ConfigurableApplicationContext applicationContext) {
    applicationContext.refresh();
}

Further more, the field applicationContextClass of SpringApplication is also declared as Class<? extends ConfigurableApplicationContext>.

I think it is reasonable enough to modify the method signature.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions