In local environment , we can configure some connection Environment properties in a property file, and then use them by context:property-placeholder. for example:
<context:property-placeholder location="classpath:resources-local.properties"/>
<smtp:endpoint host="${smtp.host}" port="${smtp.port}" user="${smtp.user}" password="${smtp.password}" name="NotificationEmail" doc:name="SMTP" to="${smtp.to}" from="${smtp.from}" subject="error" />
But when I deploy the app to cloudhub,I can set the connection info as Environment variables.We don't need to import the resources-local.properties file.We can still use the properties as
<smtp:endpoint host="${smtp.host}" port="${smtp.port}" user="${smtp.user}" password="${smtp.password}" name="NotificationEmail" doc:name="SMTP" to="${smtp.to}" from="${smtp.from}" subject="error" />
here is the question,how can I use Environment variables setted on cloudhub in java class.How can I get the smtp.host value in java class???
David told me that I can use them as they available as system properties. But How to use the system properties in java class..
Any advise?? Thanks a lot!