设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客

VMware的CloudFoundry服务新增PostgreSQL支持

2011-11-15 11:13| 发布者: joejoe0332| 查看: 2783| 评论: 0|原作者: 中国移动大云开发者社区|来自: 中国移动大云开发者社区

摘要:   年初,VMware发布了CloudFoundry,这是一个PAAS的开源方案,起初支持MongoDB,MySQL和 Redis等众多服务。最近,又加入了对PostgreSQL和RabbitMQ的支持,另外还提供了可在单独工作站运行的微型云。 由于PostgreSQ ...

    当以下两个条件同时符合时,自动配置就会利用Spring 的核心容器

    1.只有一个特定的服务类型。如:你只能在应用中绑定一个相关的数据库服务(MySQL或PostgreSQL)。

    2.只有一个匹配类型。如:在应用程序设置上下文中只有一类 DataSource。

   如果满足这些条件,Cloudfoundry就会自动拦截当地数据源,并利用Cloudfoundry服务取代Spring context中设置的服务。

   The only thing left to do is to answer positively when vmc asks for service binding when the application is uploaded to the cloud.

    接下来只需做一件事,就是当应用程序上传到云中,vmc要求绑定服务时,给出确定的回答。

    对于更复杂的应用程序来说,Spring 3.1预期加入特殊的云命名空间并和运行配置支持。

    Earlier this year VMware released CloudFoundry, an opesource PAAS solution, with initial support for several services such as MongoDB, MySQL, and Redis. Lately it has added PostgreSQL and RabbitMQ to the list of cloud services that applications can depend on, as well as offering a Micro edition of the cloud that can run on a single workstation.

    PostgreSQL is an interesting addition since it is a full featured traditional database with a different audience than MySQL or MongoDB users. To accommodate PostgreSQL, cloudfoundry does not use a vanilla version but instead a customized one based on vFabric as explained in the official blog post.

    The same post gives an example of using PostgreSQL in a Java project built with Spring Roo. Here we illustrate an alternative approach where the Java application is a Spring based WAR utilizing JPA.

    Assume that your application has a Spring context setup as below:

    This application can be uploaded to CloudFoundry completely unchanged thanks to the auto-configuration feature of CloudFoundry.

    PostgreSQL (as well as MySQL and the rest of supported services) takes advantage of the auto-configuration feature offered by Cloudfoundry. Under certain conditions a local Java Application that uses PostgreSQL can be uploaded to CloudFoundry with zero code changes.

    Auto-configuration employs the Spring Core container and takes places when both of the following are true:

    1.There may exactly be only one service of a given service type. For example, you may bind only one relational database service (MySQL or PostgreSQL) to an application.

    2.There may exactly be only one bean of the matching type. For example, you may have only one DataSource bean in the application context.

    If these requirements hold then Cloudfoundry will automatically intercept your local datasource and use the Cloudfoundry service instead of what is set in the Spring context.

    For more complex applications, Spring 3.1 is expected to add a special cloud namespace and runtime profile support.


酷毙
1

雷人

鲜花

鸡蛋

漂亮

刚表态过的朋友 (1 人)

  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部