Update sample application. (#23)
* Update sample application. * Bump CF Java Client version to 3.9.0.
This commit is contained in:
committed by
Spencer Gibb
parent
510b6ebcfc
commit
34f78e42cd
2
pom.xml
2
pom.xml
@@ -15,7 +15,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<cf-java-client.version>3.3.0.RELEASE</cf-java-client.version>
|
||||
<cf-java-client.version>3.9.0.RELEASE</cf-java-client.version>
|
||||
<bintray.package>cloudfoundry</bintray.package>
|
||||
<main.basedir>${basedir}</main.basedir>
|
||||
<spring-cloud-netflix.version>2.0.0.BUILD-SNAPSHOT</spring-cloud-netflix.version>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// to run on ur local machine this use:
|
||||
// to run locally use:
|
||||
// spring run hi-service.groovy
|
||||
//
|
||||
// to deploy this to Cloud Foundry, use
|
||||
// to deploy to Cloud Foundry use:
|
||||
// spring jar hi.jar hi-service.groovy
|
||||
// cf push hi-service -p hi.jar
|
||||
|
||||
|
||||
@@ -26,15 +26,27 @@ import org.springframework.cloud.cloudfoundry.discovery.EnableCloudFoundryClient
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
* This example assumes you've registered an application on
|
||||
* <A href="http://cloudfoundry.org">Cloud Foundry</A> named {@code hi-service} that
|
||||
* responds with a String at {@code /hi/ name} . There is a sample file in the project
|
||||
* root called {@code hi-service.groovy} which you can deploy using the {@code spring} CLI
|
||||
* and the {@code cf} CLI that works appropriately for this demonstration.
|
||||
* This example uses the Spring Cloud {@code DiscoveryClient} abstraction to list all services
|
||||
* available to the application. It should deployed to a Cloud Foundry organization and space that
|
||||
* has other applications deployed to it.
|
||||
*
|
||||
* There is a sample file in the project root called {@code hi-service.groovy} which can be
|
||||
* deployed using the {@code spring} CLI and the {@code cf} CLI that works appropriately for
|
||||
* this example.
|
||||
*
|
||||
* Either modify this application's {@code application.yml} configuration file to provide credentials
|
||||
* and other information for the Cloud Foundry the app is deployed to, or set the following
|
||||
* environment variables on the application (using {@code cf set-env}):
|
||||
*
|
||||
* * {@code CF_USERNAME}
|
||||
* * {@code CF_PASSWORD}
|
||||
* * {@code CF_ORG}
|
||||
* * {@code CF_SPACE}
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Spencer Gibb
|
||||
* @author Dave Syer
|
||||
* @author Scott Frederick
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableCloudFoundryClient
|
||||
@@ -50,7 +62,7 @@ public class CloudFoundryApplication {
|
||||
return args ->
|
||||
discoveryClient.getServices().forEach(svc -> {
|
||||
log.info("service = " + svc);
|
||||
discoveryClient.getInstances(svc).forEach(si -> log.info("\t" + si));
|
||||
discoveryClient.getInstances(svc).forEach(si -> log.info("\tinstance = " + si));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
spring.application.name=test-app
|
||||
spring.cloud.cloudfoundry.discovery.email=${email:starbuxman@gmail.com}
|
||||
spring.cloud.cloudfoundry.discovery.password=${password:xxxx}
|
||||
VCAP_APPLICATION={"limits":{"mem":1024,"disk":1024,"fds":16384},"application_version":"36eff082-96d6-498f-8214-508fda72ba65","application_name":"hi-service","application_uris":["hi-service.cfapps.io"],"version":"36eff082-96d6-498f-8214-508fda72ba65","name":"hi-service","space_name":"joshlong","space_id":"e0cd969c-3461-41ae-abde-4e11bb5acbd1","uris":["hi-service.cfapps.io"],"users":null,"application_id":"af350f7c-88c4-4e35-a04e-698a1dbc7354","instance_id":"e4843ca23bd947b28e6d4cb3f9b92cbb","instance_index":0,"host":"0.0.0.0","port":61590,"started_at":"2015-05-07 20:00:10 +0000","started_at_timestamp":1431028810,"start":"2015-05-07 20:00:10 +0000","state_timestamp":1431028810}
|
||||
@@ -0,0 +1,9 @@
|
||||
spring:
|
||||
application:
|
||||
name: test-app
|
||||
cloud:
|
||||
cloudfoundry:
|
||||
username: ${CF_USERNAME:starbuxman@gmail.com}
|
||||
password: ${CF_PASSWORD:xxxx}
|
||||
org: ${CF_ORG:}
|
||||
space: ${CF_SPACE:}
|
||||
Reference in New Issue
Block a user