Spring读取系统属性的方法就是先读system.getProperty() 然后再读 System.getenv()
程序员文章站
2022-07-12 11:57:25
...
这是整个调用的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; } }
上一篇: JAVA静态导入
下一篇: JAVA可变长度的参数(Varargs)