接入nacos 之后,想把所有的配置丢上去。

启动程序是:

@EnableDiscoveryClient
@RestController
@ComponentScan(basePackages = {"com.lkk"})
@MapperScan(basePackages = {"com.lkk.ppm.doc.service.dao"})
@ImportResource(locations = {"classpath:dubbo.xml"})
@EnableTransactionManagement
@Import({Settings.class, WebConfig.class})
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
@EnableWebMvc
@Slf4j
public class DocApplication {

bootstrap.yml文件是:

spring:
application:
name: llk_discuss_app
profiles:
active: ${PROFILE_ACTIVE:local}
cloud:
nacos:
discovery:
server-addr: ${NACOS_SERVER_ADDR:192.168.11.196:}
namespace: ${NACOS_CONFIG_NAMESPACE:1f3c60b6-3e28-44eb--7f7eeeff6a8d}
#group: ${NACOS_CONFIG_GROUP:llk}
config:
server-addr: ${NACOS_SERVER_ADDR:192.168.11.196:}
file-extension: yaml
namespace: ${NACOS_CONFIG_NAMESPACE:1f3c60b6-3e28-44eb--7f7eeeff6a8d}
group: ${NACOS_CONFIG_GROUP:llk}
ext-config[]:
data-id: llk_stateflow_toggle.yaml
group: ${NACOS_CONFIG_GROUP:llk}
refresh: true

dubbo.xml 文件是:

   <dubbo:registry  address="${NACOS_ADDR:nacos://127.0.0.1:8848}"  file="erdp_discuss_app.cache"/>
<dubbo:service interface="com.llk.ppm.discuss.domain.service.ELDiscussService" ref="discussService"/>
<dubbo:reference id="peopleService" interface="com.llk.platform.system.domain.service.ELPeopleService"/> ...

错误是

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'peopleService': FactoryBean threw exception on object creation; nested exception is java.lang.NumberFormatException: For input string: "8848}"
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
... common frames omitted
Caused by: java.lang.NumberFormatException: For input string: "8848}"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:) ~[na:1.8.0_201]
at java.lang.Integer.parseInt(Integer.java:) ~[na:1.8.0_201]
at java.lang.Integer.parseInt(Integer.java:) ~[na:1.8.0_201]
at com.alibaba.dubbo.common.URL.valueOf(URL.java:) ~[dubbo-2.6..jar:2.6.]
at com.alibaba.dubbo.common.utils.UrlUtils.parseURL(UrlUtils.java:) ~[dubbo-2.6..jar:2.6.]
at com.alibaba.dubbo.common.utils.UrlUtils.parseURLs(UrlUtils.java:) ~[dubbo-2.6..jar:2.6.]
at com.alibaba.dubbo.config.AbstractInterfaceConfig.loadRegistries(AbstractInterfaceConfig.java:) ~[dubbo-2.6..jar:2.6.]
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:) ~[dubbo-2.6..jar:2.6.]
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:) ~[dubbo-2.6..jar:2.6.]
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:) ~[dubbo-2.6..jar:2.6.]
at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:) ~[dubbo-2.6..jar:2.6.]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
... common frames omitted

花了整整一天时间,各种折腾,dubbo.xml 里面的占位符就是解析不了。

开始是以为是nacos的bug,后面以为是dubbo 的问题,最后才发现是spring-cloud-commons 的问题。我晕~~~~

开始是以为是bootstrap的问题,初始化dubbo.xml的时间太早了吗? 坑爹啊! 研究了下boostrap 和 application 配置文件的关系。无果。  后面认为是yml的格式的问题,后面把bootstrap.yml, 转换成了boostrap.properties, 结果问题依旧。想来想去,应该是xml解析的时候,bootstrap 还没有从nacos 成功获取数据的原因吧! 写了个demo试了下,好像可以了, 再套到了原来的项目里面来, 熄火了!。 可是,这到底是什么情况,bootstrap配置文件的优先级是比较高的啊! 网上一把搜索,未果,好像大家都没有遇到我这个问题。。。 后面干脆不用bootstrap配置文件,使用 application.yml/properties吧,可以了,但是nacos怎么办,不能不使用bootstrap啊!!

是ImportSource问题吗,它的解析有特殊之处, 研究其原理,无果?后面同事偶然发现,只要把dubbo.xml 分开为两个文件(一个文件有是基本信息,另外一个文件是 service/reference)就可以正常启动了, 然后继续研究,发现把 dubbo:reference 的id 属性去掉,就可以了。。 把原来的一个dubbo xml 分开了两个xml,两次ImportSource,另外还糅合导入了一个properties 就可以了,是顺序问题吗? 难道是第一次不能解析,第二次才能解析吗?。。。必须要分开吗?折腾N久,无果。从GitHub拉下来几个demo(大名鼎鼎的didi哥的学习项目),运行一把,没问题的啊!!对比一下,然后一点点的加减代码和配置吧! 发现didi哥的项目简单,所以无错,我把代码套过去,它的项目也会一样的报错了。

调试一下吧! 断点设置在RegistryConfig的setAddress方法之上。看到其堆栈, 正常的是:
setAddress:118, RegistryConfig (com.alibaba.dubbo.config)
invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
invoke:62, NativeMethodAccessorImpl (sun.reflect)
invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
invoke:498, Method (java.lang.reflect)
setValue:332, BeanWrapperImpl$BeanPropertyHandler (org.springframework.beans)
processLocalProperty:458, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValue:278, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValue:266, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValues:97, AbstractPropertyAccessor (org.springframework.beans)
setPropertyValues:77, AbstractPropertyAccessor (org.springframework.beans)
applyPropertyValues:1635, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
populateBean:1354, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
doCreateBean:572, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
createBean:495, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
lambda$doGetBean$0:317, AbstractBeanFactory (org.springframework.beans.factory.support)
getObject:-1, 1089930529 (org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$136)
getSingleton:222, DefaultSingletonBeanRegistry (org.springframework.beans.factory.support)
doGetBean:315, AbstractBeanFactory (org.springframework.beans.factory.support)
getBean:199, AbstractBeanFactory (org.springframework.beans.factory.support)
preInstantiateSingletons:759, DefaultListableBeanFactory (org.springframework.beans.factory.support)
finishBeanFactoryInitialization:869, AbstractApplicationContext (org.springframework.context.support)
refresh:550, AbstractApplicationContext (org.springframework.context.support)
refresh:140, ServletWebServerApplicationContext (org.springframework.boot.web.servlet.context)
refresh:780, SpringApplication (org.springframework.boot)
refreshContext:412, SpringApplication (org.springframework.boot)
run:333, SpringApplication (org.springframework.boot)
run:1277, SpringApplication (org.springframework.boot)
run:1265, SpringApplication (org.springframework.boot)
main:24, TestApplication (com.didispace.alibaba.nacos.config.client)

异常情况的堆栈是:
setAddress:118, RegistryConfig (com.alibaba.dubbo.config)
invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
invoke:62, NativeMethodAccessorImpl (sun.reflect)
invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
invoke:498, Method (java.lang.reflect)
setValue:332, BeanWrapperImpl$BeanPropertyHandler (org.springframework.beans)
processLocalProperty:458, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValue:278, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValue:266, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValues:97, AbstractPropertyAccessor (org.springframework.beans)
setPropertyValues:77, AbstractPropertyAccessor (org.springframework.beans)
applyPropertyValues:1630, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
populateBean:1349, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
doCreateBean:572, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
createBean:495, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
lambda$doGetBean$0:317, AbstractBeanFactory (org.springframework.beans.factory.support)
getObject:-1, 1376017854 (org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$135)
getSingleton:222, DefaultSingletonBeanRegistry (org.springframework.beans.factory.support)
doGetBean:315, AbstractBeanFactory (org.springframework.beans.factory.support)
getBean:199, AbstractBeanFactory (org.springframework.beans.factory.support)
getBeansOfType:514, DefaultListableBeanFactory (org.springframework.beans.factory.support)
getBeansOfType:1204, AbstractApplicationContext (org.springframework.context.support)
beansOfTypeIncludingAncestors:327, BeanFactoryUtils (org.springframework.beans.factory)
afterPropertiesSet:140, ReferenceBean (com.alibaba.dubbo.config.spring)
invokeInitMethods:1753, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
initializeBean:1690, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
doCreateBean:573, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
createBean:495, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
lambda$doGetBean$0:317, AbstractBeanFactory (org.springframework.beans.factory.support)
getObject:-1, 1376017854 (org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$135)
getSingleton:222, DefaultSingletonBeanRegistry (org.springframework.beans.factory.support)
doGetBean:315, AbstractBeanFactory (org.springframework.beans.factory.support)
getTypeForFactoryBean:1513, AbstractBeanFactory (org.springframework.beans.factory.support)
getTypeForFactoryBean:838, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
isTypeMatch:562, AbstractBeanFactory (org.springframework.beans.factory.support)
doGetBeanNamesForType:426, DefaultListableBeanFactory (org.springframework.beans.factory.support)
getBeanNamesForType:389, DefaultListableBeanFactory (org.springframework.beans.factory.support)
getBeanNamesForType:383, DefaultListableBeanFactory (org.springframework.beans.factory.support)
resolveNamedBean:996, DefaultListableBeanFactory (org.springframework.beans.factory.support)
getBean:338, DefaultListableBeanFactory (org.springframework.beans.factory.support)
getBean:333, DefaultListableBeanFactory (org.springframework.beans.factory.support)
isApplicable:163, RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer (org.springframework.cloud.autoconfigure)
postProcessBeanDefinitionRegistry:134, RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer (org.springframework.cloud.autoconfigure)
invokeBeanDefinitionRegistryPostProcessors:271, PostProcessorRegistrationDelegate (org.springframework.context.support)
invokeBeanFactoryPostProcessors:121, PostProcessorRegistrationDelegate (org.springframework.context.support)
invokeBeanFactoryPostProcessors:692, AbstractApplicationContext (org.springframework.context.support)
refresh:530, AbstractApplicationContext (org.springframework.context.support)
refresh:140, ServletWebServerApplicationContext (org.springframework.boot.web.servlet.context)
refresh:754, SpringApplication (org.springframework.boot)
refreshContext:386, SpringApplication (org.springframework.boot)
run:307, SpringApplication (org.springframework.boot)
main:48, TestNacosApplication (com.example.test_nacos)

一帧一帧的查看分析:

0 = "org.springframework.context.annotation.internalConfigurationAnnotationProcessor"
1 = "org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer"
2 = "refreshScope"

难道是internalConfigurationAnnotationProcessor的问题? 不像。发现RefreshAutoConfiguration 有些不对, 好像是RefreshAutoConfiguration 引起了这个问题?但是此时我依然不知道这就是RefreshAutoConfiguration的bug!(后面才知道) RefreshAutoConfiguration 为什么要这么做?不管了先, 那就把RefreshAutoConfiguration 停掉啊! 观察到配置项:spring.cloud.refresh.enabled,这个好像没什么用。那把它设置为false,然后重启,然后就可以了! 我擦,终于解决了问题!!不过,似乎高兴得太早了,引起的问题是, nacos的配置完全读取不到了!! 这怎么行呢!

同事的配置拿来研究,调试发现它的堆栈更深了:

setAddress:, RegistryConfig (com.alibaba.dubbo.config)
invoke0:-, NativeMethodAccessorImpl (sun.reflect)
invoke:, NativeMethodAccessorImpl (sun.reflect)
invoke:, DelegatingMethodAccessorImpl (sun.reflect)
invoke:, Method (java.lang.reflect)
setValue:, BeanWrapperImpl$BeanPropertyHandler (org.springframework.beans)
processLocalProperty:, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValue:, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValue:, AbstractNestablePropertyAccessor (org.springframework.beans)
setPropertyValues:, AbstractPropertyAccessor (org.springframework.beans)
setPropertyValues:, AbstractPropertyAccessor (org.springframework.beans)
applyPropertyValues:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
populateBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
doCreateBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
createBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
lambda$doGetBean$:, AbstractBeanFactory (org.springframework.beans.factory.support)
getObject:-, (org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$)
getSingleton:, DefaultSingletonBeanRegistry (org.springframework.beans.factory.support)
doGetBean:, AbstractBeanFactory (org.springframework.beans.factory.support)
getBean:, AbstractBeanFactory (org.springframework.beans.factory.support)
getBeansOfType:, DefaultListableBeanFactory (org.springframework.beans.factory.support)
getBeansOfType:, AbstractApplicationContext (org.springframework.context.support)
beansOfTypeIncludingAncestors:, BeanFactoryUtils (org.springframework.beans.factory)
afterPropertiesSet:, ReferenceBean (com.alibaba.dubbo.config.spring)
invokeInitMethods:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
initializeBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
doCreateBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
createBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
lambda$doGetBean$:, AbstractBeanFactory (org.springframework.beans.factory.support)
getObject:-, (org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$)
getSingleton:, DefaultSingletonBeanRegistry (org.springframework.beans.factory.support)
doGetBean:, AbstractBeanFactory (org.springframework.beans.factory.support)
getTypeForFactoryBean:, AbstractBeanFactory (org.springframework.beans.factory.support)
getTypeForFactoryBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
isTypeMatch:, AbstractBeanFactory (org.springframework.beans.factory.support)
doGetBeanNamesForType:, DefaultListableBeanFactory (org.springframework.beans.factory.support)
getBeanNamesForType:, DefaultListableBeanFactory (org.springframework.beans.factory.support)
beanNamesForTypeIncludingAncestors:, BeanFactoryUtils (org.springframework.beans.factory)
findAutowireCandidates:, DefaultListableBeanFactory (org.springframework.beans.factory.support)
doResolveDependency:, DefaultListableBeanFactory (org.springframework.beans.factory.support)
resolveDependency:, DefaultListableBeanFactory (org.springframework.beans.factory.support)
resolveAutowiredArgument:, ConstructorResolver (org.springframework.beans.factory.support)
createArgumentArray:, ConstructorResolver (org.springframework.beans.factory.support)
instantiateUsingFactoryMethod:, ConstructorResolver (org.springframework.beans.factory.support)
instantiateUsingFactoryMethod:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
createBeanInstance:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
doCreateBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
createBean:, AbstractAutowireCapableBeanFactory (org.springframework.beans.factory.support)
lambda$doGetBean$:, AbstractBeanFactory (org.springframework.beans.factory.support)
getObject:-, (org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$)
getSingleton:, DefaultSingletonBeanRegistry (org.springframework.beans.factory.support)
doGetBean:, AbstractBeanFactory (org.springframework.beans.factory.support)
getBean:, AbstractBeanFactory (org.springframework.beans.factory.support)
registerBeanPostProcessors:, PostProcessorRegistrationDelegate (org.springframework.context.support)
registerBeanPostProcessors:, AbstractApplicationContext (org.springframework.context.support)
refresh:, AbstractApplicationContext (org.springframework.context.support)
refresh:, ServletWebServerApplicationContext (org.springframework.boot.web.servlet.context)
refresh:, SpringApplication (org.springframework.boot)
refreshContext:, SpringApplication (org.springframework.boot)
run:, SpringApplication (org.springframework.boot)
main:, DiscussApplication (com.llk.ppm.discuss)

可见异常情况下,堆栈深了不少,但是依然不知道具体原因。然后继续加减研究,发现把 dubbo:reference 的id 属性去掉,就可以了!!! 观察发现去掉之后就beanDefinition names不会包含这个reference, 之前是367, 现在变成了366:

org.springframework.beans.factory.support.DefaultListableBeanFactory@44c5a16f: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,testNacosApplication,org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory,helloService222,helloService,helloService1,repositoryController,profileController,alpsController,repositorySchemaController,repositoryEntityController,repositoryPropertyReferenceController,repositorySearchController,aaaaaaa,com.alibaba.dubbo.config.RegistryConfig,com.alibaba.dubbo.config.ProviderConfig,dubbo,com.lkk.ppm.discuss.domain.service.ELDiscussService,bbbbbbbb,org.springframework.boot.autoconfigure.AutoConfigurationPackages,org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,org.springframework.boot.autoconfigure.condition.BeanTypeRegistry,propertySourcesPlaceholderConfigurer,org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration$TomcatWebSocketConfiguration,websocketServletWebServerCustomizer,org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration,org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat,tomcatServletWebServerFactory,org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration,servletWebServerFactoryCustomizer,tomcatServletWebServerFactoryCustomizer,server-org.springframework.boot.autoconfigure.web.ServerProperties,org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor,org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata,webServerFactoryCustomizerBeanPostProcessor,errorPageRegistrarBeanPostProcessor,org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration,dispatcherServlet,spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties,org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration,dispatcherServletRegistration,org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration,org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration$PropagateEventsConfiguration,org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration,configurableEnvironmentConfiguration,org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,defaultValidator,methodValidationPostProcessor,org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration,error,beanNameViewResolver,org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration,conventionErrorViewResolver,org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration,errorAttributes,basicErrorController,errorPageCustomizer,preserveErrorControllerTargetClassPostProcessor,spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties,org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration,faviconHandlerMapping,faviconRequestHandler,org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration,requestMappingHandlerAdapter,requestMappingHandlerMapping,mvcConversionService,mvcValidator,mvcContentNegotiationManager,mvcPathMatcher,mvcUrlPathHelper,viewControllerHandlerMapping,beanNameHandlerMapping,resourceHandlerMapping,mvcResourceUrlProvider,defaultServletHandlerMapping,mvcUriComponentsContributor,httpRequestHandlerAdapter,simpleControllerHandlerAdapter,handlerExceptionResolver,mvcViewResolver,mvcHandlerMappingIntrospector,org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter,defaultViewResolver,viewResolver,welcomePageHandlerMapping,requestContextFilter,org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration,hiddenHttpMethodFilter,httpPutFormContentFilter,org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari,dataSource,org.springframework.boot.autoconfigure.jdbc.DataSourceJmxConfiguration$Hikari,org.springframework.boot.autoconfigure.jdbc.DataSourceJmxConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$PooledDataSourceConfiguration,org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration,hikariPoolDataSourceMetadataProvider,org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker,org.springframework.boot.autoconfigure.jdbc.DataSourceInitializationConfiguration,dataSourceInitializerPostProcessor,org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties,com.baomidou.mybatisplus.spring.boot.starter.MybatisPlusAutoConfiguration$MapperScannerRegistrarNotFoundConfiguration,com.baomidou.mybatisplus.spring.boot.starter.MybatisPlusAutoConfiguration,sqlSessionFactory,sqlSessionTemplate,mybatis-plus-com.baomidou.mybatisplus.spring.boot.starter.MybatisPlusProperties,org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration$MapperScannerRegistrarNotFoundConfiguration,org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration,mybatis-org.mybatis.spring.boot.autoconfigure.MybatisProperties,org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,mbeanExporter,objectNamingStrategy,mbeanServer,org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,springApplicationAdminRegistrar,org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$CglibAutoProxyConfiguration,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.boot.autoconfigure.aop.AopAutoConfiguration,org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$RefreshScopeBeanDefinitionEnhancer,org.springframework.cloud.autoconfigure.RefreshAutoConfiguration,refreshScope,loggingRebinder,contextRefresher,refreshEventListener,org.springframework.boot.autoconfigure.data.redis.LettuceConnectionConfiguration,lettuceClientResources,redisConnectionFactory,org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,redisTemplate,stringRedisTemplate,spring.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties,org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration,persistenceExceptionTranslationPostProcessor,org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,mongo,spring.data.mongodb-org.springframework.boot.autoconfigure.mongo.MongoProperties,org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration,mongoDbFactory,mongoTemplate,mappingMongoConverter,mongoMappingContext,gridFsTemplate,mongoCustomConversions,org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration,org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration,reactiveRedisTemplate,org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration,keyValueMappingContext,redisCustomConversions,redisReferenceResolver,redisConverter,redisKeyValueAdapter,redisKeyValueTemplate,org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration,gsonBuilder,gson,standardGsonBuilderCustomizer,spring.gson-org.springframework.boot.autoconfigure.gson.GsonProperties,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration,standardJacksonObjectMapperBuilderCustomizer,spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration,jacksonObjectMapperBuilder,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$ParameterNamesModuleConfiguration,parameterNamesModule,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration,jacksonObjectMapper,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration,jsonComponentModule,org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration,stringHttpMessageConverter,spring.http.encoding-org.springframework.boot.autoconfigure.http.HttpEncodingProperties,org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration,mappingJackson2HttpMessageConverter,org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration,org.springframework.boot.autoconfigure.http.GsonHttpMessageConvertersConfiguration,org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration,messageConverters,org.springframework.hateoas.config.EntityLinksConfiguration,entityLinksPluginRegistry,delegatingEntityLinks,controllerEntityLinks,controllerLinkBuilderFactoryBean,org.springframework.hateoas.config.JaxRsConfigurationImportSelector$JaxRsEntityLinksConfiguration,jaxRsEntityLinks,org.springframework.hateoas.config.HateoasConfiguration,linkRelationMessageSource,jackson2ModuleRegisteringBeanPostProcessor,defaultRelProvider,annotationRelProvider,_relProvider,relProviderPluginRegistry,linkDiscoverers,linkDiscovererRegistry,org.springframework.data.web.config.SpringDataJacksonConfiguration,jacksonGeoModule,org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration,repositories,repositoryRelProvider,persistentEntities,defaultConversionService,validatingRepositoryEventListener,jpaHelper,repositoryRestConfiguration,projectionDefinitionRegistrar,metadataConfiguration,baseUri,annotatedEventHandlerInvoker,domainObjectMerger,serverHttpRequestMethodArgumentResolver,repoRequestArgumentResolver,resourceMetadataHandlerMethodArgumentResolver,backendIdHandlerMethodArgumentResolver,eTagArgumentResolver,entityLinks,persistentEntityArgumentResolver,jsonSchemaConverter,resourceDescriptionMessageSourceAccessor,jacksonHttpMessageConverter,halJacksonHttpMessageConverter,uriListHttpMessageConverter,resourceProcessorInvoker,repositoryExporterHandlerAdapter,restHandlerMapping,resourceMappings,linkCollector,excerptProjector,repositoryRestExceptionHandler,repositoryInvokerFactory,defaultMessageConverters,alpsJsonHttpMessageConverter,pageableResolver,sortResolver,backendIdConverterRegistry,auditableBeanWrapperFactory,httpHeadersPreparer,selfLinkProvider,associationLinks,enumTranslator,alpsConverter,profileResourceProcessor,pagedResourcesAssembler,pagedResourcesAssemblerArgumentResolver,org.springframework.hateoas.config.ConverterRegisteringWebMvcConfigurer#,org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration,springBootRepositoryRestConfigurer,spring.data.rest-org.springframework.boot.autoconfigure.data.rest.RepositoryRestProperties,org.springframework.boot.autoconfigure.hateoas.HypermediaHttpMessageConverterConfiguration,halMessageConverterSupportedMediaTypeCustomizer,org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration,spring.hateoas-org.springframework.boot.autoconfigure.hateoas.HateoasProperties,org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$JacksonCodecConfiguration,jacksonCodecCustomizer,org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration,org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration,spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties,org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration$JdbcTemplateConfiguration,jdbcTemplate,org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration$NamedParameterJdbcTemplateConfiguration,namedParameterJdbcTemplate,org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration,spring.jdbc-org.springframework.boot.autoconfigure.jdbc.JdbcProperties,org.springframework.boot.autoconfigure.reactor.core.ReactorCoreAutoConfiguration,spring.reactor-org.springframework.boot.autoconfigure.reactor.core.ReactorCoreProperties,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$DataSourceTransactionManagerConfiguration,transactionManager,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration,org.springframework.transaction.config.internalTransactionAdvisor,transactionAttributeSource,transactionInterceptor,org.springframework.transaction.config.internalTransactionalEventListenerFactory,org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$EnableTransactionManagementConfiguration$CglibAutoProxyConfiguration,org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$EnableTransactionManagementConfiguration,org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration$TransactionTemplateConfiguration,transactionTemplate,org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration,platformTransactionManagerCustomizers,spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties,org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration,restTemplateBuilder,org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration$TomcatWebServerFactoryCustomizerConfiguration,tomcatWebServerFactoryCustomizer,org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration,org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration,characterEncodingFilter,localeCharsetMappingsCustomizer,org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration,multipartConfigElement,multipartResolver,spring.servlet.multipart-org.springframework.boot.autoconfigure.web.servlet.MultipartProperties,org.springframework.cloud.alibaba.nacos.NacosConfigAutoConfiguration,nacosConfigProperties,nacosRefreshProperties,nacosRefreshHistory,nacosContextRefresher,org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationConfiguration,spring.cloud.service-registry.auto-registration-org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationProperties,org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationAutoConfiguration,org.springframework.cloud.alibaba.nacos.NacosDiscoveryAutoConfiguration,nacosServiceRegistry,nacosRegistration,nacosAutoServiceRegistration,org.springframework.cloud.alibaba.nacos.discovery.NacosDiscoveryClientAutoConfiguration,nacosProperties,nacosDiscoveryClient,nacosWatch,org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration,ribbonFeature,springClientFactory,loadBalancerClient,propertiesFactory,default.org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration.RibbonClientSpecification,ribbon.eager-load-org.springframework.cloud.netflix.ribbon.RibbonEagerLoadProperties,ribbon-org.springframework.cloud.netflix.ribbon.ServerIntrospectorProperties,org.springframework.cloud.alibaba.nacos.ribbon.RibbonNacosAutoConfiguration,default.org.springframework.cloud.alibaba.nacos.ribbon.RibbonNacosAutoConfiguration.RibbonClientSpecification,org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration,configurationPropertiesBeans,configurationPropertiesRebinder,org.springframework.cloud.autoconfigure.LifecycleMvcEndpointAutoConfiguration,environmentManager,org.springframework.cloud.client.CommonsClientAutoConfiguration,org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClientAutoConfiguration,compositeDiscoveryClient,org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration,simpleDiscoveryProperties,simpleDiscoveryClient,org.springframework.cloud.client.loadbalancer.AsyncLoadBalancerAutoConfiguration$LoadBalancerInterceptorConfig,asyncLoadBalancerInterceptor,asyncRestTemplateCustomizer,org.springframework.cloud.client.loadbalancer.AsyncLoadBalancerAutoConfiguration$AsyncRestTemplateCustomizerConfig,loadBalancedAsyncRestTemplateInitializer,org.springframework.cloud.client.loadbalancer.AsyncLoadBalancerAutoConfiguration,org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration$LoadBalancerInterceptorConfig,ribbonInterceptor,restTemplateCustomizer,org.springframework.cloud.client.loadbalancer.LoadBalancerAutoConfiguration,loadBalancedRestTemplateInitializerDeprecated,loadBalancerRequestFactory,spring.cloud.loadbalancer.retry-org.springframework.cloud.client.loadbalancer.LoadBalancerRetryProperties,org.springframework.cloud.client.serviceregistry.ServiceRegistryAutoConfiguration,org.springframework.cloud.commons.httpclient.HttpClientConfiguration$ApacheHttpClientConfiguration,connManFactory,apacheHttpClientBuilder,apacheHttpClientFactory,org.springframework.cloud.commons.httpclient.HttpClientConfiguration,org.springframework.cloud.commons.util.UtilAutoConfiguration,inetUtilsProperties,inetUtils]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@52d239ba

然后就不会去解析 registry,然后 registry 里面占位符就不会被提前解析,然后就没问题了! 但是 dubbo:reference 的id 属性可以去掉吗? 领导的回复是否定的。。

但是他的方案确实是可以的,至少启动不报错。后面把他的两个配置文件合并到一个,发现也可以了! 后面仔细对比,一个个的加减配置,发现它的配置的特别之处是:

<dubbo:application name="${spring.application.name}"   logger="slf4j">

我的配置的 dubbo:application name属性没有使用通配符,他的使用了。 确实,只要使用通配符就可以了,但是一个潜在问题是,调试发现application name属性的赋值很多次,前几次是不正确的,后台出现一些列的warning。而且其他配置如果继续使用通配符的话, 又会报错。 我就日了狗了, 感觉dubbo坑爹了。。

那能不能让dubbo reference 延迟加载?把 dubbo 配置的 lazy 设为true,无效。 init设为 false,无效。lazy-init 设为false,报错:

元素 'dubbo:reference' 中不允许出现属性 'lazy-init'。

我靠,dubbo竟然不支持默认的bean的配置,坑爹。 难道要我改dubbo 源码?。。。

这样看来,两种方案都是不可行的。 真是郁闷了,一天半时间了啊! 难道是nacos 的坑吗? 要不要换成携程的apollo 试试。。

bing上搜索RefreshAutoConfiguration bug,终于看到了答案:
https://github.com/spring-cloud/spring-cloud-config/issues/1167
https://github.com/spring-cloud/spring-cloud-commons/commit/9b8a70e5574e1c0e7cb071d4248f7a0d567187ad#diff-09d0c681fbe54b8a84f6bfa2f96ed21b

原来是 RefreshAutoConfiguration的 bug,RefreshAutoConfiguration的方法,调用getBean方法, 而它是一个非常重的方法,它直接导致了 提前触发整个beanfactory 解析,加载 以及初始化,而这个时候 springboot 还没有启动完,所以还没来得及从nacos 加载数据, 从而导致了 registry 里面的占位符解析不了( 其实是任何占位符都解析不了。), 从而导致了这个严重问题。 观察到RefreshAutoConfiguration是 spring cloud commons 里面的类,然后看到spring cloud commons是通过spring-cloud-dependencies 指定版本的,我的spring-cloud-dependencies的版本是F:

        <dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>

参照GitHub的那个issue,升级一下改成G版本就好了:

            <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>           

不过,似乎高兴得太早了,引起的新问题是,

-- ::16.584 ERROR  --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.AbstractMethodError: null
at org.springframework.core.OrderComparator.findOrder(OrderComparator.java:) ~[spring-core-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.core.annotation.AnnotationAwareOrderComparator.findOrder(AnnotationAwareOrderComparator.java:) ~[spring-core-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.core.OrderComparator.getOrder(OrderComparator.java:) ~[spring-core-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.core.OrderComparator.getOrder(OrderComparator.java:) ~[spring-core-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.core.OrderComparator.doCompare(OrderComparator.java:) ~[spring-core-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.core.OrderComparator.compare(OrderComparator.java:) ~[spring-core-5.0..RELEASE.jar:5.0..RELEASE]
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:) ~[na:1.8.0_201]
at java.util.TimSort.sort(TimSort.java:) ~[na:1.8.0_201]
at java.util.Arrays.sort(Arrays.java:) ~[na:1.8.0_201]
at java.util.ArrayList.sort(ArrayList.java:) ~[na:1.8.0_201]
at org.springframework.boot.SpringApplication.asUnmodifiableOrderedSet(SpringApplication.java:) ~[spring-boot-2.0..RELEASE.jar:2.0..RELEASE]
at org.springframework.boot.SpringApplication.getListeners(SpringApplication.java:) ~[spring-boot-2.0..RELEASE.jar:2.0..RELEASE]
at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:) ~[spring-boot-2.0..RELEASE.jar:2.0..RELEASE]
at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:) ~[spring-boot-2.0..RELEASE.jar:2.0..RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:) ~[spring-boot-2.0..RELEASE.jar:2.0..RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:) ~[spring-boot-2.0..RELEASE.jar:2.0..RELEASE]
at com.example.test_nacos.TestNacosApplication.main(TestNacosApplication.java:) [classes/:na]

看来还是有版本问题,后面发现springboot也要升级到2.1.3.RELEASE。完毕!

参考:
https://github.com/alibaba/nacos/issues/1147
https://github.com/spring-cloud/spring-cloud-config/issues/1167
https://github.com/spring-cloud/spring-cloud-commons/commit/9b8a70e5574e1c0e7cb071d4248f7a0d567187ad#diff-09d0c681fbe54b8a84f6bfa2f96ed21b
https://www.oschina.net/question/3672709_2303162

Spring Cloud Finchley.SR1 版本的坑:placeholer占位符无法解析!的更多相关文章

  1. 关于spring cloud “Finchley.RC2”版本在spring cloud config中的ArrayIndexOutOfBoundsException

    原文 https://www.cnblogs.com/Little-tree/p/9166382.html 在学spring cloud config的时候遇到一个ArrayIndexOutOfBou ...

  2. 确定稳定的 Spring Cloud 相关环境版本

    开发部署 Spring Cloud 微服务框架,需要先确定 Spring Cloud 的相关环境版本,主要包含:Spring Cloud.Spring Cloud Netflix.JDK.JRE.Ja ...

  3. Spring Cloud Finchley 正式发布,包含 4 个重大更新!

    在 Spring 的官方博客上已经看到 Spring Cloud Finchley 在 06 月 19 日这一天正式发布了,我们在 Maven 中央仓库也看到了最新版的更新. Finchley 正式版 ...

  4. spring cloud 2.x版本 Ribbon服务发现教程(内含集成Hystrix熔断机制)

    本文采用Spring cloud本文为2.1.8RELEASE,version=Greenwich.SR3 前言 本文基于前两篇文章eureka-server和eureka-client的实现. 参考 ...

  5. spring cloud 2.x版本 Eureka Server服务注册中心教程

    本文采用Spring cloud本文为2.1.8RELEASE,version=Greenwich.SR3 1.创建服务注册中心 1.1 新建Spring boot工程:eureka-server 1 ...

  6. spring cloud 2.x版本 Eureka Client服务提供者教程

    本文采用Spring cloud本文为2.1.8RELEASE,version=Greenwich.SR3 1 创建eureka client 1.1 新建Srping boot工程:eureka-c ...

  7. spring cloud 2.x版本 Feign服务发现教程(内含集成Hystrix熔断机制)

    前言 本文采用Spring cloud本文为2.1.8RELEASE,version=Greenwich.SR3 本文基于前两篇文章eureka-server和eureka-client的实现. 参考 ...

  8. spring cloud 2.x版本 Zuul路由网关教程

    前言 本文采用Spring cloud本文为2.1.8RELEASE,version=Greenwich.SR3 本文基于前两篇文章eureka-server.eureka-client.eureka ...

  9. spring cloud 2.x版本 Gateway动态路由教程

    摘要 本文采用的Spring cloud为2.1.8RELEASE,version=Greenwich.SR3 本文基于前面的几篇Spring cloud Gateway文章的实现. 参考 Gatew ...

随机推荐

  1. 处理器CPU天梯图,显卡天梯图(性能排名图)

    自己网上找的几个图,仅供参考,买电脑可以看看了~

  2. CSS 使用id属性的规则

    html中的id属性是什么?本篇文章给大家带来的内容是介绍html中的id属性,让大家了解id属性的使用方法,希望对大家有所帮助. html的id属性是什么? html的id属性其实就是一个HTML元 ...

  3. python模块2

    python模块2 相关概念 模块名是标识符(需要按照标识符的写法编写) Pyc文件 在使用模块的项目中会生成一个_pycache_文件,里面存放着编译过的(模块的)字节码缓存文件(因为模块一般很少有 ...

  4. windows系统tomcat上开发的j2ee程序,如何适配linux系统上奔跑的websphere7

    公司需要将几个windows系统tomcat中间件下开发的j2ee系统部署到linux系统websphere7中间件下去运行. 这就需要做系统的适配工作.由于时间比较久了,具体问题就不详细写了.把这个 ...

  5. 了解BootLoader——基于MPC5744P Bootloader例程

    一.BootLoader的作用:BootLoader是固化在PFlash中的一个程序,其作用可以分为两部分:boot和load. (1)boot:MCU上电时首先会运行BootLoader程序(因为它 ...

  6. python 拷贝文件夹下的文件 到 另一个文件夹

    import os,shutil def copy_search_file(srcDir, desDir): ls = os.listdir(srcDir) for line in ls: fileP ...

  7. Bomb后端云使用

    Bomb是后台云托管工具,在Bomb官网注册会员,即可免费使用后台数据库服务.https://www.bmob.cn/app/list 创建应用后,在设置里获取密钥.根据官方文档集成. 在集成后运行时 ...

  8. [TimLinux] scrapy 在Windows平台的安装

    1. 安装Python 这个不去细说,官网直接下载,安装即可,我自己选择的版本是 Python 3.6.5 x86_64bit windows版本. 2. 配置PATH 我用的windows 10系统 ...

  9. 第4节:Java基础 - 必知必会(中)

    第4节:Java基础 - 必知必会(中) 本小节是Java基础篇章的第二小节,主要讲述抽象类与接口的区别,注解以及反射等知识点. 一.抽象类和接口有什么区别 抽象类和接口的主要区别可以总结如下: 抽象 ...

  10. 2019 ICPC上海网络赛 A 题 Lightning Routing I (动态维护树的直径)

    题目: 给定一棵树, 带边权. 现在有2种操作: 1.修改第i条边的权值. 2.询问u到其他一个任意点的最大距离是多少. 题解: 树的直径可以通过两次 dfs() 的方法求得.换句话说,到任意点最远的 ...