我有一个弹簧云问题:执行应用程序时,我没有使用application.yml中的设置,因为spring.cloud.config 。让我在这里提供更多细节。 我想我的服务可以从远程ConfigServer获取设置。我已将ConfigServer创建为带有注释@EnableConfigServer的Spring Boot应用程序。 后,我已经创建了下一个配置文件,客户端应用程序:执行应用程序时,不会使用application.yml中的设置执行应用程序
application:
name: mw
cloud:
config:
enabled: true
uri: http://172.17.42.1:8888
fail-fast: true
主类:
@EnableEurekaClient
@SpringBootApplication
public class MwApplication
和额外的配置到应用程序:
@Configuration
@EnableJpaRepositories(basePackages = {"com.sample.repository"})
@EnableTransactionManagement
@EnableScheduling
public class AppConfiguration
还我旁边的依赖关系:
spring-cloud-starter-eureka
spring-cloud-config-client
spring-boot-configuration-processor
spring-boot-starter-data-jpa
当我执行我的客户端应用程序,因为我得到了这样的信息:ConfigServicePropertySourceLocator:找不到PropertySource:对GET请求“http://localhost:8888/mw/default”
的应用程序试图从默认的URI(本地主机)的数据I/O错误,而不是从我的设置中使用uri。我已经在调试模式下看过app,看到org.springframework.cloud.config.client.ConfigServiceBootstrapConfiguration创建了ConfigClientProperties和默认属性,我的application.yml设置没有被使用。
我在做什么错了? 谢谢。
我已经尝试过了,再次添加,但没有改变的,我还是有这个问题 – slippery
尝试移动application.yml配置bootstrap.yml – Andonaeus
现在的作品,谢谢!你能说出为什么它不适用于应用程序。阳明海运? 我没有自己创建application.yml。它是由spring构造函数 – slippery