You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
However, ApolloConfigRegistrar and DefaultApolloConfigRegistrarHelper are both of type ImportBeanDefinitionRegistrar, which doesn't support EnvironmentAware until Spring 3.2.x
see spring-projects/spring-framework@146a66f
So the environment variable will always be null if running with Spring versions prior to 3.2.x, which explains why npe occurred.
Describe the bug
When using
@EnableApolloConfig
with Spring 3.1.1, NullPointerException will occur.To Reproduce
Steps to reproduce the behavior:
@EnableApolloConfig
Expected behavior
The application should work well
Screenshots
If applicable, add screenshots to help explain your problem.
Additional Details & Logs
The text was updated successfully, but these errors were encountered: