Describe the bug
When using @EnableApolloConfig with Spring 3.1.1, NullPointerException will occur.
To Reproduce
Steps to reproduce the behavior:
- Mark a configuration class with
@EnableApolloConfig
@Configuration
@EnableApolloConfig(value = "application", order = 10)
public class AppConfig {
@Bean
public NormalBean normalBean(@Value("${batch:100}") int batch) {
NormalBean bean = new NormalBean();
bean.setBatch(batch);
return bean;
}
}
- Run the application with Spring version 3.1.1
- NullPointerException will occur
Exception in thread "main" java.lang.NullPointerException
at com.ctrip.framework.apollo.spring.spi.DefaultApolloConfigRegistrarHelper.resolveNamespaces(DefaultApolloConfigRegistrarHelper.java:52)
at com.ctrip.framework.apollo.spring.spi.DefaultApolloConfigRegistrarHelper.registerBeanDefinitions(DefaultApolloConfigRegistrarHelper.java:29)
at com.ctrip.framework.apollo.spring.annotation.ApolloConfigRegistrar.registerBeanDefinitions(ApolloConfigRegistrar.java:20)
at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:331)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:228)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:149)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:126)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:263)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:203)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:617)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
at com.ctrip.framework.apollo.demo.spring.AnnotationApplication.main(AnnotationApplication.java:12)
Expected behavior
The application should work well
Screenshots
If applicable, add screenshots to help explain your problem.
Additional Details & Logs
- Version
- Error logs
- Configuration
- Platform and Operating System
Describe the bug
When using
@EnableApolloConfigwith Spring 3.1.1, NullPointerException will occur.To Reproduce
Steps to reproduce the behavior:
@EnableApolloConfigExpected behavior
The application should work well
Screenshots
If applicable, add screenshots to help explain your problem.
Additional Details & Logs