简体   繁体   English

如何从 Linux 命令行或 docker 容器中检查 spring 启动 java 应用程序消耗了哪些值

[英]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.

相关问题 从 Linux 命令行启动 Spring 引导 web 应用程序 - Start Spring Boot web application from Linux command line 如何从docker命令行设置参数以配置spring boot应用程序? - How can I set parameters from docker command line to configure spring boot application? 如何从 spring 启动 java 应用程序在 Z05B6053C41A2130AFD6FC3BE158 中执行 python 程序 - How to execute python program from spring boot java application in docker 将命令行参数传递给在Docker中运行的Java应用程序(Spring Boot) - Pass command line args to Java app (Spring Boot) running in Docker Google Cloud Platform管道/容器构建器在Spring Boot Java Application中使用COPY或ADD命令构建docker映像时出现问题 - Google Cloud Platform pipeline/container builder issue building docker image using COPY or ADD command for Spring Boot Java Application 我们如何手动重置通过 Spring Boot Java 应用程序消耗的 kafka 主题的偏移量? - How can we manually reset the offset of a kafka topic which is consumed through a spring boot java application? 在docker容器中重新部署spring-boot应用程序? - Redeploy spring-boot application in docker container? 如何从docker容器内的java / spring-boot项目运行python脚本(并接收输出)? - How to run python script (and receive output) from java/spring-boot project which is inside a docker container? 从命令行运行Spring Boot应用程序时出错 - Error running Spring Boot application from command line Linux 命令启动 spring 引导应用程序 - Linux command to start spring boot application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM