java - 如何将 SCP Neo 中目标服务的电子邮件配置绑定到 Spring Boot 应用程序?
问题描述
我想在 SAP Cloud Platform Neo 环境中部署一个 Spring Boot 应用程序。它有一个端点/sendmail
,在调用时会向特定用户发送邮件。目前,我已将凭据硬编码在application.properties
文件中,并且可以正常工作。该文件如下所示 -
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=...
spring.mail.password=...
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.writetimeout=5000
现在,我想利用 SCP 平台的目标服务,我将在其中定义邮件帐户的凭据。我想从目标服务中获取凭据。那么,什么需要进入application.properties
文件?
我在 SCP - Cloud Foundry 中执行了类似的操作,但针对不同的服务(数据库)。CF 具有可用于获取凭据的 VCAP 环境变量,如下所示 -
spring.datasource.url=${vcap.services.${vcap.services.name}.credentials.url}
在 Neo 中可以做同样的事情吗?
解决方案
您可以使用 SAP S/4HANA Cloud SDK 检索目标及其属性。您可以在此处找到更多信息。
推荐阅读
- vba - 在 VBA SQL 查询中将字符串转换为 int
- sql - 在 Oracle 中执行内部联接时如何转义字符串中的特殊字符?
- kubernetes - 运行 kubectl get services 时端口列表中的冒号是什么意思
- javascript - 在 Google 图表栏中打印 2 个名称
- javascript - 我想将变量的值存储在会话存储中,以便它在页面保持不变
- java - JFrame 更改的鼠标单击事件
- javascript - 在 django 服务器上使用 ajax 自动引用页面不起作用
- tensorflow - 被信号 11 打断:SIGSEGV
- c# - 如何将列表视图项的上下文菜单绑定到 ICommand
- android - iOS / Android firebase 后台同步