[英]How to check what values are consumed by a spring boot java application from the Linux command line or in the docker container
How to check what values are consumed by a spring boot java application from the Linux command line or in the docker container?如何从 Linux 命令行或 docker 容器中检查 spring 启动 java 应用程序消耗了哪些值?
I have a spring boot java application that has the below parameters for email我有一个 spring 启动 java 应用程序,它具有以下参数 email
spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=admin@qtech.com
spring.mail.password=${GPASSWORD}
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.ssl.trust=smtp.gmail.com
I'm passing GPASSWORD as an environment variable to the docker/k8s container.我将 GPASSWORD 作为环境变量传递给 docker/k8s 容器。
How can I check what value/values are being consumed by the java application, especially spring.mail.password field.如何检查 java 应用程序正在使用哪些值,尤其是 spring.mail.password 字段。
I tried the below commands我尝试了以下命令
printenv
env
But they list all environment variables being passed to all containers like the below environment variable.但是他们列出了传递给所有容器的所有环境变量,例如下面的环境变量。
GPASSWORD=bond007
So Is there a way to check what values are being consumed by the spring boot java application inside a pod or container?那么有没有办法检查 pod 或容器内的 spring boot java 应用程序正在使用哪些值?
You can use Slf4j annotation and log like below:您可以使用 Slf4j 注释和日志,如下所示:
@Value("${spring.mail.host}")
private String mailHost;
log.info("spring.mail.host: "+mailHost);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.