亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量

發布時間:2020-08-10 19:20:15 來源:ITPUB博客 閱讀:209 作者:i042416 欄目:云計算

本文使用的例子源代碼在我的github上。

在我的公眾號文章在SAP云平臺的CloudFoundry環境下消費ABAP On-Premise OData服務介紹了如何通過Cloud Connector連接ABAP On-Premise系統。

如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量

我創建了三個service的實例,詳情如上圖和下表:

服務類型 服務實例名稱
connectivity connectivity-jerry-demo
destination jerry-destination-lite
xsuaa xsuaa-jerry-demo
如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量

這三個服務實例的名稱維護在應用的manifest.xml中。

將應用使用cf push部署到CloudFoundry之后,在Cockpit里能觀察到生成的系統變量VCAP_SERVICES:

如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量

在Java代碼里,使用如下代碼將該環境變量的值讀取出來存儲到字符串中。

 private static final String VCAP_SERVICES = System.getenv("VCAP_SERVICES"); 

該Json對象的具體字段通過getJSONObject讀取出來。

如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量

下圖是connectivity實例的credentials明細:

如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量
如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量

要獲取更多Jerry的原創技術文章,請關注公眾號"汪子熙"或者掃描下面二維碼:

如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量
如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量

附錄

VCAP_SERVICES全部內容:

 { "VCAP_SERVICES": { "xsuaa": [
            { "name": "xsuaa-jerry-demo", "instance_name": "xsuaa-jerry-demo", "binding_name": null, "credentials": { "uaadomain": "authentication.eu10.hana.ondemand.com", "tenantmode": "dedicated", "sburl": "https://internal-xsuaa.authentication.eu10.hana.ondemand.com", "clientid": "sb-connectivity-jerry-demo!t3704", "verificationkey": "-----BEGIN PUBLIC KEY-----MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwThn6OO9kj0bchkOGkqYBnV1dQ3zU/xtj7Kj7nDd8nyRMcEWCtVzrzjzhiisRhlrzlRIEY82wRAZNGKMnw7cvCwNixcfcDJnjzgr2pJ+5/yDZUc0IXXyIWPZD+XdL+0EogC3d4+fqyvg/BF/F0t2hKHWr/UTXE6zrGhBKaL0d8rKfYd6olGWigFd+3+24CKI14zWVxUBtC+P9Fhngc9DRzkXqhxOK/EKn0HzSgotf5duq6Tmk9DCNM4sLW4+ERc6xzrgbeEexakabvax/Az9WZ4qhwgw+fwIhKIC7WLwCEJaRsW4m7NKkv+eJR2LKYesuQ9SVAJ3EXV86RwdnH4uAv7lQHsKURPVAQBlranSqyQu0EXs2N9OlWTxe+FyNkIvyZvoLrZl/CdlYc8AKxRm5rn2/88nkrYQ0XZSrnICM5FRWgVF2hn5KfZGwtBN85/D4Yck6B3ocMfyX7e4URUm9lRPQFUJGTXaZnEIge0R159HUwhTN1HvyXrs6uT1ZZmW+c3p47dw1+LmUf/hIf8zd+uvHQjIeHEJqxjqfyA8yqAFKRHKVFrwnwdMHIsRap2EKBhHMfeVf0P2th6C9MggYoGCvdIaIUgMBX3TtCdvGrcWML7hnyS2zkrlA8SoKJnRcRF2KxWKs355FhpHpzqyZflO5l98+O8wOsFjGpL9d0ECAwEAAQ==-----END PUBLIC KEY-----", "xsappname": "connectivity-jerry-demo!t3704", "identityzone": "jerry", "identityzoneid": "f3bd7f84-ebf1-4c11-b7c7-a278ebd54dcb", "clientsecret": "WAxzZxYQCgB7Dkml8dFdU+kaLSE=", "tenantid": "f3bd7f84-ebf1-4c11-b7c7-a278ebd54dcb", "url": "https://jerry.authentication.eu10.hana.ondemand.com" }, "syslog_drain_url": null, "volume_mounts": [], "label": "xsuaa", "provider": null, "plan": "application", "tags": [ "xsuaa" ]
            }
        ], "connectivity": [
            { "name": "connectivity-jerry-demo", "instance_name": "connectivity-jerry-demo", "binding_name": null, "credentials": { "uaadomain": "authentication.eu10.hana.ondemand.com", "onpremise_proxy_port": "20003", "tenantmode": "dedicated", "clientid": "sb-clone5282c913c9164bb284239adcc4d74210!b3704|connectivity!b17", "verificationkey": "-----BEGIN PUBLIC KEY-----MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwThn6OO9kj0bchkOGkqYBnV1dQ3zU/xtj7Kj7nDd8nyRMcEWCtVzrzjzhiisRhlrzlRIEY82wRAZNGKMnw7cvCwNixcfcDJnjzgr2pJ+5/yDZUc0IXXyIWPZD+XdL+0EogC3d4+fqyvg/BF/F0t2hKHWr/UTXE6zrGhBKaL0d8rKfYd6olGWigFd+3+24CKI14zWVxUBtC+P9Fhngc9DRzkXqhxOK/EKn0HzSgotf5duq6Tmk9DCNM4sLW4+ERc6xzrgbeEexakabvax/Az9WZ4qhwgw+fwIhKIC7WLwCEJaRsW4m7NKkv+eJR2LKYesuQ9SVAJ3EXV86RwdnH4uAv7lQHsKURPVAQBlranSqyQu0EXs2N9OlWTxe+FyNkIvyZvoLrZl/CdlYc8AKxRm5rn2/88nkrYQ0XZSrnICM5FRWgVF2hn5KfZGwtBN85/D4Yck6B3ocMfyX7e4URUm9lRPQFUJGTXaZnEIge0R159HUwhTN1HvyXrs6uT1ZZmW+c3p47dw1+LmUf/hIf8zd+uvHQjIeHEJqxjqfyA8yqAFKRHKVFrwnwdMHIsRap2EKBhHMfeVf0P2th6C9MggYoGCvdIaIUgMBX3TtCdvGrcWML7hnyS2zkrlA8SoKJnRcRF2KxWKs355FhpHpzqyZflO5l98+O8wOsFjGpL9d0ECAwEAAQ==-----END PUBLIC KEY-----", "xsappname": "clone5282c913c9164bb284239adcc4d74210!b3704|connectivity!b17", "identityzone": "jerry", "clientsecret": "nyiGD9QQSOZO+NTeEJdexWWjxYY=", "tenantid": "f3bd7f84-ebf1-4c11-b7c7-a278ebd54dcb", "url": "https://jerry.authentication.eu10.hana.ondemand.com", "onpremise_proxy_host": "10.0.85.1" }, "syslog_drain_url": null, "volume_mounts": [], "label": "connectivity", "provider": null, "plan": "lite", "tags": [ "connectivity", "conn", "connsvc" ]
            }
        ], "destination": [
            { "name": "jerry-destination-lite", "instance_name": "jerry-destination-lite", "binding_name": null, "credentials": { "uaadomain": "authentication.eu10.hana.ondemand.com", "tenantmode": "dedicated", "clientid": "sb-clone39a01503ac1845fbbda5d5ffccb1a469!b3704|destination-xsappname!b404", "instanceid": "39a01503-ac18-45fb-bda5-d5ffccb1a469", "verificationkey": "-----BEGIN PUBLIC KEY-----MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwThn6OO9kj0bchkOGkqYBnV1dQ3zU/xtj7Kj7nDd8nyRMcEWCtVzrzjzhiisRhlrzlRIEY82wRAZNGKMnw7cvCwNixcfcDJnjzgr2pJ+5/yDZUc0IXXyIWPZD+XdL+0EogC3d4+fqyvg/BF/F0t2hKHWr/UTXE6zrGhBKaL0d8rKfYd6olGWigFd+3+24CKI14zWVxUBtC+P9Fhngc9DRzkXqhxOK/EKn0HzSgotf5duq6Tmk9DCNM4sLW4+ERc6xzrgbeEexakabvax/Az9WZ4qhwgw+fwIhKIC7WLwCEJaRsW4m7NKkv+eJR2LKYesuQ9SVAJ3EXV86RwdnH4uAv7lQHsKURPVAQBlranSqyQu0EXs2N9OlWTxe+FyNkIvyZvoLrZl/CdlYc8AKxRm5rn2/88nkrYQ0XZSrnICM5FRWgVF2hn5KfZGwtBN85/D4Yck6B3ocMfyX7e4URUm9lRPQFUJGTXaZnEIge0R159HUwhTN1HvyXrs6uT1ZZmW+c3p47dw1+LmUf/hIf8zd+uvHQjIeHEJqxjqfyA8yqAFKRHKVFrwnwdMHIsRap2EKBhHMfeVf0P2th6C9MggYoGCvdIaIUgMBX3TtCdvGrcWML7hnyS2zkrlA8SoKJnRcRF2KxWKs355FhpHpzqyZflO5l98+O8wOsFjGpL9d0ECAwEAAQ==-----END PUBLIC KEY-----", "xsappname": "clone39a01503ac1845fbbda5d5ffccb1a469!b3704|destination-xsappname!b404", "identityzone": "jerry", "clientsecret": "QCnO+2k8gvUkdTyiCZI5rhzylbQ=", "tenantid": "f3bd7f84-ebf1-4c11-b7c7-a278ebd54dcb", "uri": "https://destination-configuration.cfapps.eu10.hana.ondemand.com", "url": "https://jerry.authentication.eu10.hana.ondemand.com" }, "syslog_drain_url": null, "volume_mounts": [], "label": "destination", "provider": null, "plan": "lite", "tags": [ "destination", "document" ]
            }
        ], "application-logs": [
            { "name": "jerry-log", "instance_name": "jerry-log", "binding_name": null, "credentials": {}, "syslog_drain_url": "https://10.0.104.16:4433/syslogv2/ZmE4OTNmMjYtNjllZS00YTRhLWFhMDQtOGY4YWUwNjc2NDc1L2Nvbm5lY3Rpdml0eS1qZXJyeS1kZW1vLzY5YWJmZDQ2LWQyMjgtNDkwMy1iMjQ1LWRlODhjZWZmMzY0Mi9kZXYvMDE2ZGUwODktMDc0MS00NzlhLTgyOGEtNDVjNGVmMTY5MzUyL0kwNDI0MTZ0cmlhbF9qZXJyeS8wNWMyYzY0Ny1lYjYwLTQwYjQtYjhiYi02NTEyYTBlZmQ2NjIvYXBwbGljYXRpb24tbG9ncy8zZTQ2NmZjNi04MzNlLTQzMGEtYTVhMS1iOWFhMjMxOTUwYzgvbGl0ZS81MWYzYWE3Mi1lYzE4LTQ4YTgtYTVjNS1lNGJlMWVlMDQ2MTUvamVycnktbG9nLzA3Y2MwOWZlZTFmM2VjNDNhYWIzZmMzMTAwMzQ5NTMwYmIzMjJmODE0NDE1ZGI3MTBkM2JlM2NmMDliNTI4Mjc", "volume_mounts": [], "label": "application-logs", "provider": null, "plan": "lite", "tags": []
            }
        ]
    }
}
{ "VCAP_APPLICATION": { "cf_api": "https://api.cf.eu10.hana.ondemand.com", "limits": { "fds": 16384, "mem": 512, "disk": 1024 }, "application_name": "connectivity-jerry-demo", "application_uris": [ "connectivity-jerry-demo-i042416.cfapps.eu10.hana.ondemand.com" ], "name": "connectivity-jerry-demo", "space_name": "dev", "space_id": "69abfd46-d228-4903-b245-de88ceff3642", "uris": [ "connectivity-jerry-demo-i042416.cfapps.eu10.hana.ondemand.com" ], "users": null, "application_id": "fa893f26-69ee-4a4a-aa04-8f8ae0676475", "version": "d964d7cc-e067-4810-b834-25c995fe1bc5", "application_version": "d964d7cc-e067-4810-b834-25c995fe1bc5" }
} 

要獲取更多Jerry的原創技術文章,請關注公眾號"汪子熙"或者掃描下面二維碼:

如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量
如何在Java代碼中使用SAP云平臺CloudFoundry環境的環境變量
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

合作市| 盱眙县| 裕民县| 江安县| 广汉市| 荔波县| 始兴县| 米林县| 班戈县| 驻马店市| 济源市| 聊城市| 襄汾县| 宜君县| 新泰市| 辰溪县| 靖边县| 泾阳县| 原平市| 奉贤区| 太仓市| 丰顺县| 郴州市| 三亚市| 名山县| 个旧市| 富宁县| 洛阳市| 望江县| 承德县| 伊吾县| 贵州省| 衡南县| 关岭| 涟源市| 巢湖市| 社会| 炉霍县| 正镶白旗| 姚安县| 阜城县|