Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitializer : com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:465)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:444)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:435)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:271)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:252)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)
at cn.creditu.SsoServiceApplication.main(SsoServiceApplication.java:16)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer]: Constructor threw exception; nested exception is com.ctrip.framework.apollo.exceptions.ApolloConfigException: Unable to load instance for com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory!
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:182)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:461)
... 7 more
Caused by: com.ctrip.framework.apollo.exceptions.ApolloConfigException: Unable to load instance for com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory!
at com.ctrip.framework.apollo.spring.util.SpringInjector.getInstance(SpringInjector.java:40)
at com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer.<init>(ApolloApplicationContextInitializer.java:66)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.__newInstance(DelegatingConstructorAccessorImpl.java:45)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45009)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45012)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:170)
... 8 more
Caused by: com.ctrip.framework.apollo.exceptions.ApolloConfigException: Unable to initialize Apollo Spring Injector!
at com.ctrip.framework.apollo.spring.util.SpringInjector.getInjector(SpringInjector.java:24)
at com.ctrip.framework.apollo.spring.util.SpringInjector.getInstance(SpringInjector.java:37)
... 16 more
Caused by: java.lang.NoSuchMethodError: com.google.common.collect.Maps.newConcurrentMap()Ljava/util/concurrent/ConcurrentMap;
at com.google.inject.internal.SingletonScope.<clinit>(SingletonScope.java:106)
at com.google.inject.Scopes.<clinit>(Scopes.java:39)
at com.google.inject.internal.InjectorShell$RootModule.configure(InjectorShell.java:294)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
at com.google.inject.spi.Elements.getElements(Elements.java:110)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
at com.google.inject.Guice.jrCreateInjector(Guice.java:99)
at com.google.inject.Guice.createInjector(Guice.java:40001)
at com.google.inject.Guice.createInjector(Guice.java:73)
at com.google.inject.Guice.createInjector(Guice.java:62)
at com.ctrip.framework.apollo.spring.util.SpringInjector.getInjector(SpringInjector.java:22)
... 17 more
原因:
apollo-client中guava-16.0.1.jar和google-collections-1.0.jar 包冲突