我正在尝试访问存储在本地系统中的帐户 ID。
Microsoft Windows [Version 10.0.19042.1110]
(c) Microsoft Corporation. All rights reserved.
C:\Users\shiva>echo %TWILIO_ACCOUNT_SID%
Cfc0db83ecf359067cb7289850db
我可以在 CMD 中查看存储在变量中的值,但是当尝试在 Spring 代码中访问相同的值时,我得到了 null
以下是我尝试访问变量的一些方法
1. public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
2. @Value("${TWILIO_ACCOUNT_SID}")
private String accountSID;
3. @Autowired
private Environment env;
System.out.println(env.getProperty("TWILIO_ACCOUNT_SID"));
