Spring 在 Pivotal Cloud Foundry 平台上部署时,启动微服务无法通过 Kerberos 身份验证
Spring Boot Micro-service fails Kerberos Authentication when deployed on Pivotal Cloud Foundry Platform
我们开发了一个 Spring 启动应用程序来从 HDP 2.5 上的 Hbase 查询数据。
当我们在本地 windows 机器上 运行 应用程序工作正常,因为它能够找到保存在应用程序资源文件夹下的 jaas.conf & krb5.conf 文件并且我们在我们的代码中将它们作为系统属性提供,例如
System.setProperties("javax.security.auth.useSubjectCredsOnly","false");
System.setProperty("java.security.krb5.conf","D:\host\workspace\projectname\src\main\resources\krb5.conf");
然而,当我们在 PCF 中部署时,它无法读取那些设置为系统属性的文件。
问题
PCF 中如何设置环境变量?
我们如何将文件放在 PCF 中,以便它们可用于应用程序的类路径?
您可以在部署清单文件中指定环境变量。
这是details。
这是假设您的 jar 文件与 krb5.conf
文件打包在一起。
另一种选择是使用配置服务器。这里有关于Spring Cloud Config
的介绍
我们开发了一个 Spring 启动应用程序来从 HDP 2.5 上的 Hbase 查询数据。
当我们在本地 windows 机器上 运行 应用程序工作正常,因为它能够找到保存在应用程序资源文件夹下的 jaas.conf & krb5.conf 文件并且我们在我们的代码中将它们作为系统属性提供,例如
System.setProperties("javax.security.auth.useSubjectCredsOnly","false");
System.setProperty("java.security.krb5.conf","D:\host\workspace\projectname\src\main\resources\krb5.conf");
然而,当我们在 PCF 中部署时,它无法读取那些设置为系统属性的文件。
问题
PCF 中如何设置环境变量?
我们如何将文件放在 PCF 中,以便它们可用于应用程序的类路径?
您可以在部署清单文件中指定环境变量。 这是details。
这是假设您的 jar 文件与 krb5.conf
文件打包在一起。
另一种选择是使用配置服务器。这里有关于Spring Cloud Config
的介绍