PropertyOverrideConfigurer (Spring Framework 6.0.7 API)()

  本篇文章为你整理了PropertyOverrideConfigurer (Spring Framework 6.0.7 API)()的详细内容,包含有 PropertyOverrideConfigurer (Spring Framework 6.0.7 API),希望能帮助你了解 PropertyOverrideConfigurer (Spring Framework 6.0.7 API)。

  public class PropertyOverrideConfigurer

  extends PropertyResourceConfigurer

  Property resource configurer that overrides bean property values in an application

   context definition. It pushes values from a properties file into bean definitions.

   Configuration lines are expected to be of the following form:

  

beanName.property=value

 

   Example properties file:

  

dataSource.driverClassName=com.mysql.jdbc.Driver

 

   dataSource.url=jdbc:mysql:mydb

 

   In contrast to PropertyPlaceholderConfigurer, the original definition can have default

   values or no values at all for such bean properties. If an overriding properties file does

   not have an entry for a certain bean property, the default context definition is used.

   Note that the context definition is not aware of being overridden;

   so this is not immediately obvious when looking at the XML definition file.

   Furthermore, note that specified override values are always literal values;

   they are not translated into bean references. This also applies when the original

   value in the XML bean definition specifies a bean reference.

   In case of multiple PropertyOverrideConfigurers that define different values for

   the same bean property, the last one will win (due to the overriding mechanism).

   Property values can be converted after reading them in, through overriding

   the convertPropertyValue method. For example, encrypted values

   can be detected and decrypted accordingly before processing them.

  Since:

  12.03.2003

  Author:

  Juergen Hoeller, Rod Johnson

  See Also:

  
DEFAULT_BEAN_NAME_SEPARATOR

  public static finalStringDEFAULT_BEAN_NAME_SEPARATOR

  The default bean name separator.

  See Also:

  
setBeanNameSeparator

  publicvoidsetBeanNameSeparator(StringbeanNameSeparator)

  Set the separator to expect between bean name and property path.

   Default is a dot (".").

  
setIgnoreInvalidKeys

  publicvoidsetIgnoreInvalidKeys(booleanignoreInvalidKeys)

  Set whether to ignore invalid keys. Default is "false".

   If you ignore invalid keys, keys that do not follow the beanName.property format

   (or refer to invalid bean names or properties) will just be logged at debug level.

   This allows one to have arbitrary other keys in a properties file.

  
hasPropertyOverridesFor

  publicbooleanhasPropertyOverridesFor(StringbeanName)

  Were there overrides for this bean?

   Only valid after processing has occurred at least once.

  Parameters:

  beanName - name of the bean to query status for

  Returns:

  whether there were property overrides for the named bean

  以上就是PropertyOverrideConfigurer (Spring Framework 6.0.7 API)()的详细内容,想要了解更多 PropertyOverrideConfigurer (Spring Framework 6.0.7 API)的内容,请持续关注盛行IT软件开发工作室。

郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。

留言与评论(共有 条评论)
   
验证码: