Spring读取系统属性的方法就是先读system.getProperty() 然后再读 System.getenv()
这是整个调用的Stacktrace
Thread [main] (Suspended) owns: Object (id=22) PropertyPlaceholderConfigurer.resolveSystemProperty(String) line: 358 PropertyPlaceholderConfigurer.resolvePlaceholder(String, Properties, int) line: 324 PropertyPlaceholderConfigurer$PropertyPlaceholderConfigurerResolver.resolvePlaceholder(String) line: 418 PropertyPlaceholderHelper.parseStringValue(String, PlaceholderResolver, Set<String>) line: 146 PropertyPlaceholderHelper.replacePlaceholders(String, PropertyPlaceholderHelper$PlaceholderResolver) line: 125 PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(String) line: 403 BeanDefinitionVisitor.resolveStringValue(String) line: 281 BeanDefinitionVisitor.resolveValue(Object) line: 202 BeanDefinitionVisitor.visitPropertyValues(MutablePropertyValues) line: 140 BeanDefinitionVisitor.visitBeanDefinition(BeanDefinition) line: 81 PropertyPlaceholderConfigurer.processProperties(ConfigurableListableBeanFactory, Properties) line: 284 PropertyPlaceholderConfigurer(PropertyResourceConfigurer).postProcessBeanFactory(ConfigurableListableBeanFactory) line: 75 FileSystemXmlApplicationContext(AbstractApplicationContext).invokeBeanFactoryPostProcessors(Collection<BeanFactoryPostProcessor>, ConfigurableListableBeanFactory) line: 663 FileSystemXmlApplicationContext(AbstractApplicationContext).invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory) line: 638 FileSystemXmlApplicationContext(AbstractApplicationContext).refresh() line: 407 FileSystemXmlApplicationContext.<init>(String[], boolean, ApplicationContext) line: 140 FileSystemXmlApplicationContext.<init>(String) line: 84 Main.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; } }
相关推荐
Morelia 2020-11-03
love0u 2020-08-16
xiaouncle 2020-07-31
踩风火轮的乌龟 2020-07-26
THEEYE 2020-06-25
DAV数据库 2020-06-17
lightlanguage 2020-06-13
kuoying 2020-06-07
地下库 2020-05-29
HappyHeng 2020-05-28
lysanderK 2020-05-26
Caleb0 2020-05-08
boredbird 2020-05-06
<add key="RedisPath" value="127.0.0.1:6379"/> todo:这里配置自己redis的ip地址和端口号。//ReadServerList:可读的Redis链接地
天空一样的蔚蓝 2020-05-05
cyydjt 2020-05-04
TyCoding 2020-05-03