Deploying a Spring application to CloudFoundry.com is simple. As SpringSource says, after registering and applying for a CloudFoundrybeta account
Deploying Spring applications to CloudFoundry.com is simple. As SpringSource says, after registering and applying for a Cloud Foundry beta account
Deploying Spring applications to CloudFoundry.com is simple, as SpringSource says.
After you register your Cloud Foundry beta account, install CloudFoundry in STS for Eclipse. Here is a blog detailing how to install it. I will not describe it here.
In order to deploy and run an application that uses databases, there are more steps than deploying a separate application, but they are only one point.
To allocate database resources to an application, you must first specify the data source to use. Open Cloud Foundry server in Eclipse and click add to open the service control disk.
In the following interface, select the data source type and name. Click "Finish". The data source is registered.
After registering a data source, you must tell the application which data source to use. Simply drag the data source to the Application Services panel.
These are all the configurations required by the server. Before deploying an application, you also need to make some changes to specify the data source.
Because I deployed a Spring application, I need to change the application context file to specify the data source to the Cloud Foundry Database, instead of pointing to the local database. The benefit of using a database on the Cloud Foundry Cloud is that you don't have to configure the database any more. All you need is to configure the data source in the servlet-context.xml file in the application.
Here, let's take a look at the local configuration:
For local deployment, the configuration usually looks like this:
Class = "org. springframework. jdbc. datasource. DriverManagerDataSource"
P: driverClassName = "$ {jdbc. driverClassName }"
P: url = "$ {jdbc. url}"/>
The MySQL database configuration on Cloud Foundry is as follows:
Spring3.1 contains a new feature that allows these configurations to be placed in the same context file, but Spring3 does not have this feature. We need to configure the Rule Data Source (traditional) select one of the new cloud data-source configuration data sources.
To use the new cloud tag, the servlet-context.xml needs to make relevant changes to introduce the cloud namespace.
... Xmlns: cloud = "http://schema.cloudfoundry.org/spring"
...
">
The last step to deploy an application is to add Cloud Foundry support. You can add Cloud Foundry support by adding the following dependencies to the pom. xml file of the application.
Org. cloudfoundry
Cloudfoundry-runtime
$ {Org. cloudfoundry-version}
0.6.0
After all these changes are successful, the Cloud Foundry application can use STS for eclipse to control application deployment, start, and stop.