[英]CloudException: No suitable cloud connector found
My project has dependencies on spring-boot-starter-cloud-connectors
and spring-cloud-localconfig-connector
.我的项目依赖于
spring-boot-starter-cloud-connectors
和spring-cloud-localconfig-connector
。 Here is my code:这是我的代码:
@Configuration
class MyConfig {
@Bean
public CloudFactory cloudFactory() {
CloudFactory cf = new CloudFactory();
cf.registerCloudConnector(new LocalConfigConnector());
return cf;
}
}
@Component
class MyComponent {
@Autowired
CloudFactory cf;
@EventListener(value = ApplicationStartedEvent.class)
public void postConstruct() {
Cloud cloud = cf.getCloud();
}
}
When I try to run the above code locally, I get an exception saying:当我尝试在本地运行上面的代码时,我得到一个异常说:
org.springframework.cloud.CloudException: No suitable cloud connector found
org.springframework.cloud.CloudException:找不到合适的云连接器
Although, the parent's version is irrelevant but I am using 2.1.8.RELEASE
.虽然,父母的版本无关紧要,但我使用的是
2.1.8.RELEASE
。
Can someone point out what's wrong with the above code?有人可以指出上面的代码有什么问题吗?
You have to add the default datasource:您必须添加默认数据源:
mysql://user:password@localhost:3306/databasename
You can set it using the run configuration or create a seperate properties
file for it.您可以使用运行配置对其进行设置或为其创建单独的
properties
文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.