简体   繁体   English

部署和连接Cloud Foundry服务(MongoDB,Java,Spring Boot)

[英]Deploying and Connecting cloud foundry service (MongoDB, Java, Spring Boot)

How to connect cloud foundry services to a spring boot maven project? 如何将Cloud Foundry服务连接到Spring Boot Maven项目? I thought putting spring.data.mongodb.uri = uri to the property file will solve the problem. 我认为将spring.data.mongodb.uri = uri放入属性文件将解决此问题。 Is there additional step to connect to the services created in cloud foundry? 是否有其他步骤可以连接到在Cloud Foundry中创建的服务? Thanks. 谢谢。 btw i add service using sts by checking the service in the deploying step. 顺便说一句,我通过在部署步骤中检查服务来使用sts添加服务。

@Bean
    public MongoDbFactory mongoDbFactory() {
        CloudEnvironment cloudEnvironment = new CloudEnvironment();
        MongoServiceInfo serviceInfo = cloudEnvironment.getServiceInfo("servicename", MongoServiceInfo.class);
        MongoServiceCreator serviceCreator = new MongoServiceCreator();
        return serviceCreator.createService(serviceInfo);
    }

so i add this code but it still hangs in the deployment. 所以我添加了这段代码,但是它仍然挂在部署中。 Is the service name is the service instance name? 服务名称是服务实例名称吗?

In order to connect cloud foundry services, you have to extend AbstractCloudConfig class in Spring Boot App by using @Configuration annotation. 为了连接云铸造服务,您必须使用@Configuration注释在Spring Boot App中扩展AbstractCloudConfig类。 I recommend you to read https://docs.cloudfoundry.org/buildpacks/java/configuring-service-connections/spring-service-bindings.html#javaconfig 我建议您阅读https://docs.cloudfoundry.org/buildpacks/java/configuring-service-connections/spring-service-bindings.html#javaconfig

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 spring-boot 应用程序部署到云代工厂时出现 java.lang.NoSuchMethodException - java.lang.NoSuchMethodException when deploying spring-boot app to cloud foundry 在Cloud Foundry中部署Java插件 - deploying java plugins in cloud foundry Spring Boot应用程序在云铸造厂java.lang.IllegalStateException上崩溃 - spring boot app crashing on cloud foundry java.lang.IllegalStateException 将Spring应用程序部署到Cloud Foundry时出错 - Error when deploying Spring app to Cloud Foundry 将微服务部署到Cloud Foundry - Deploying microservices to Cloud Foundry 使用 java11 在谷歌云上使用 mysql 部署 Spring 启动应用程序 - Deploying a Spring boot application with mysql on google cloud with java11 在Cloud Foundry Java API中获取服务密钥 - Get service key in Cloud Foundry Java API 在 Docker 中连接 Spring 引导和 MongoDB - Connecting Spring Boot and MongoDB in Docker 有没有一种方法可以在不使用spring的情况下验证普通java应用程序(云铸造中的微服务)中approuter发送的oauth令牌 - Is there a way to validate oauth token sent by approuter in plain java application ( micro service in cloud foundry ) without using spring 将Java Webapp部署到Cloud Foundry会产生Pool Empty错误 - Deploying Java Webapp to Cloud Foundry produces Pool Empty error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM