原本微服务客户端能正常从配置中心获取到配置,添加spring-boot-starter-security依赖后获取不到配置了
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
报错如下:Could not locate PropertySource: Could not extract response: no suitable HttpMessageConverter found for response type [class org.springframework.cloud.config.environment.Environment] and content type [text/html;charset=UTF-8]
config-center中添加了应有配置
spring.security.user.name=root spring.security.user.password=root
访问配置中心的接口需要登录,说明配置中心正常。
检查微服务A也添加有对应配置
spring.cloud.config.username=root spring.cloud.config.password=root
想起配置spring.cloud.config.uri是在bootstrap.properties中配置,
会不会也是配置位置错了,把配置移到bootstrap.properties中后果然正常了