0

System Information

Spring Cloud Data Flow Cloud Foundry: v1.1.0.RELEASE Pivotal Cloud Foundry: v1.7.12 CF Client (Windows): cf.exe version 6.23.1+a70deb3.2017-01-13 cf-v3-plugin: 0.6.7

I would like to inject the stream name into a bean defined in my custom source module. From reviewing the /env end-point of a deployed stream I found the SPRING_CLOUD_APPLICATION_GROUP system property so I've injected this into my bean like so.

/**
 * application name
 */
@Value("#{ systemProperties['SPRING_CLOUD_APPLICATION_GROUP'] }")
private String applicationName;

The issue here is that this appears to be tied to the Cloud Foundry deployer, which from my perspective is not good for portability.

In Spring XD the xd.stream.name placeholder existed for this purpose.

Is there any way to do this in a way that is portable.

Thank you

1 Answers1

0

All deployer implementations should honor this variable name, so you should be good to go.

There is no strong requirement that this is passed as an environment variable though (your code assumes system property, not even sure it works, does it?). Using the Spring Environment abstraction is the best way to stay portable here.

ebottard
  • 1,997
  • 2
  • 12
  • 14
  • Sorry for the delayed response. The system property is working as part of a integration test, but obviously I was controlling how the property was being injected. I never got to deploying it to PCF. The `Environment` approach did work though. Thanks. – Paul Barriscale Mar 01 '17 at 16:23