Browse Source

Fix test

Contribution was not applied on the actual use case

See gh-28915
pull/28922/head
Stephane Nicoll 3 years ago
parent
commit
e5f9574800
  1. 6
      spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorAotContributionTests.java

6
spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorAotContributionTests.java

@ -94,13 +94,13 @@ class ConfigurationClassPostProcessorAotContributionTests { @@ -94,13 +94,13 @@ class ConfigurationClassPostProcessorAotContributionTests {
@Test
void applyToWhenHasImportAwareConfigurationRegistersBeanPostProcessorAfterApplicationContextAwareProcessor() {
BeanFactoryInitializationAotContribution contribution = getContribution(
ImportConfiguration.class);
TestAwareCallbackConfiguration.class);
contribution.applyTo(this.generationContext, this.beanFactoryInitializationCode);
compile((initializer, compiled) -> {
GenericApplicationContext freshContext = new AnnotationConfigApplicationContext();
GenericApplicationContext freshContext = new GenericApplicationContext();
DefaultListableBeanFactory freshBeanFactory = freshContext.getDefaultListableBeanFactory();
initializer.accept(freshBeanFactory);
freshContext.registerBean(TestAwareCallbackConfiguration.class);
freshContext.registerBean(TestAwareCallbackBean.class);
freshContext.refresh();
TestAwareCallbackBean bean = freshContext.getBean(TestAwareCallbackBean.class);
assertThat(bean.instances).hasSize(2);

Loading…
Cancel
Save