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.