Spring读取系统属性的方法就是先读system.getProperty() 然后再读 System.getenv()
这是整个调用的Stacktrace
Thread [main] (Suspended)owns: Object (id=22)PropertyPlaceholderConfigurer.resolveSystemProperty(String) line: 358PropertyPlaceholderConfigurer.resolvePlaceholder(String, Properties, int) line: 324PropertyPlaceholderConfigurer$PropertyPlaceholderConfigurerResolver.resolvePlaceholder(String) line: 418PropertyPlaceholderHelper.parseStringValue(String, PlaceholderResolver, Set<String>) line: 146PropertyPlaceholderHelper.replacePlaceholders(String, PropertyPlaceholderHelper$PlaceholderResolver) line: 125PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(String) line: 403BeanDefinitionVisitor.resolveStringValue(String) line: 281BeanDefinitionVisitor.resolveValue(Object) line: 202BeanDefinitionVisitor.visitPropertyValues(MutablePropertyValues) line: 140BeanDefinitionVisitor.visitBeanDefinition(BeanDefinition) line: 81PropertyPlaceholderConfigurer.processProperties(ConfigurableListableBeanFactory, Properties) line: 284PropertyPlaceholderConfigurer(PropertyResourceConfigurer).postProcessBeanFactory(ConfigurableListableBeanFactory) line: 75FileSystemXmlApplicationContext(AbstractApplicationContext).invokeBeanFactoryPostProcessors(Collection<BeanFactoryPostProcessor>, ConfigurableListableBeanFactory) line: 663FileSystemXmlApplicationContext(AbstractApplicationContext).invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory) line: 638FileSystemXmlApplicationContext(AbstractApplicationContext).refresh() line: 407FileSystemXmlApplicationContext.<init>(String[], boolean, ApplicationContext) line: 140FileSystemXmlApplicationContext.<init>(String) line: 84Main.main(String[]) line: 14
/** * Resolve the given key as JVM system property, and optionally also as * system environment variable if no matching system property has been found. * @param key the placeholder to resolve as system property key * @return the system property value, or <code>null</code> if not found * @see #setSearchSystemEnvironment * @see java.lang.System#getProperty(String) * @see java.lang.System#getenv(String) */protected String resolveSystemProperty(String key) {try {String value = System.getProperty(key);if (value == null && this.searchSystemEnvironment) {value = System.getenv(key);}return value;}catch (Throwable ex) {if (logger.isDebugEnabled()) {logger.debug("Could not access system property '" + key + "': " + ex);}return null;}}