mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
put all nacos config metadata to bootstrap
This commit is contained in:
@@ -63,15 +63,7 @@ public class NacosConfigAutoConfigurationTests {
|
||||
@Test
|
||||
public void testNacosConfigProperties() {
|
||||
|
||||
NacosPropertySourceLocator nacosPropertySourceLocator = this.context.getBean(NacosPropertySourceLocator.class);
|
||||
Environment environment = this.context.getEnvironment();
|
||||
try{
|
||||
nacosPropertySourceLocator.locate(environment);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
NacosConfigProperties nacosConfigProperties = this.context.getBean(NacosConfigProperties.class);
|
||||
NacosConfigProperties nacosConfigProperties = this.context.getParent().getBean(NacosConfigProperties.class);
|
||||
assertThat(nacosConfigProperties.getFileExtension()).isEqualTo("properties");
|
||||
assertThat(nacosConfigProperties.getPrefix()).isEqualTo("myapp");
|
||||
|
||||
|
@@ -68,15 +68,14 @@ public class NacosConfigBootstrapConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
Field configServiceField = ReflectionUtils
|
||||
.findField(NacosPropertySourceLocator.class, "configService");
|
||||
configServiceField.setAccessible(true);
|
||||
Field nacosConfigPropertiesField = ReflectionUtils
|
||||
.findField(NacosPropertySourceLocator.class, "nacosConfigProperties");
|
||||
nacosConfigPropertiesField.setAccessible(true);
|
||||
|
||||
ConfigService configService = (ConfigService) ReflectionUtils
|
||||
.getField(configServiceField, locator);
|
||||
NacosConfigProperties configService = (NacosConfigProperties) ReflectionUtils
|
||||
.getField(nacosConfigPropertiesField, locator);
|
||||
|
||||
assertThat(configService).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user