Post construction configuration does not retain original configurations. I am not sure if this is the expected behavior. I am using M4.

Here is my test:

JavaConfigApplicationContext initialContext = new JavaConfigApplicationContext(ThreadConfig.class);

JavaConfigApplicationContext finalContext = new JavaConfigApplicationContext();
finalContext.setParent(initialContext);
finalContext.addConfigClass(AppConfig.class);
finalContext.addConfigClass(DataConfig.class);
finalContext.refresh();

But, when I debug, I do not see the ThreadConfig in the finalContext configClasses. So when I refresh finalContext, my initial context configClasses are not retained? Also, I tried setAllowBeanDefinitionOverriding to true, but that didn't help either.

On a similar note, probably section, 3.1.1.3. "Post-construction configuration" needs to update the code sample to use the addConfigClass API, right?.

I don't think setConfigClasses is a valid API in JavaConfigApplicationContext anymore since M4.

Appreciate your help.

Best regards
Arul