public class JndiPropertySource extends PropertySource<JndiLocatorDelegate>
JndiLocatorDelegate
からプロパティを読み取る PropertySource
実装。 デフォルトでは、基礎となる JndiLocatorDelegate
は、"resourceRef"
プロパティが true
に設定されて構成されます。つまり、検索された名前には、公開された JNDI 命名規則SEに合わせて "java:comp/env/" というプレフィックスが自動的に付けられます。この設定を上書きするか、プレフィックスを変更するには、JndiLocatorDelegate
を手動で構成し、それを受け入れるコンストラクターの 1 つに提供します。カスタム JNDI プロパティを提供する場合も同じです。これらは、JndiPropertySource
を構築する前に JndiAccessor.setJndiEnvironment(java.util.Properties)
を使用して指定する必要があります。
StandardServletEnvironment
にはデフォルトで JndiPropertySource
が含まれており、基礎となる JndiLocatorDelegate
のカスタマイズは ApplicationContextInitializer
または WebApplicationInitializer
内で実行できることに注意してください。
JndiLocatorDelegate
, ApplicationContextInitializer
, WebApplicationInitializer
, StandardServletEnvironment
PropertySource.StubPropertySource
logger, name, source
コンストラクターと説明 |
---|
JndiPropertySource(java.lang.String name) 指定された名前で新しい JndiPropertySource を作成し、任意の名前の前に "java:comp/env/" を付けるように構成された JndiLocatorDelegate を作成します。 |
JndiPropertySource(java.lang.String name, JndiLocatorDelegate jndiLocator) 指定された名前と指定された JndiLocatorDelegate で新しい JndiPropertySource を作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
java.lang.Object | getProperty(java.lang.String name) この実装は、基になる JndiLocatorDelegate から指定された名前に関連付けられた値を検索して返します。 |
containsProperty, equals, getName, getSource, hashCode, named, toString
public JndiPropertySource(java.lang.String name)
JndiPropertySource
を作成し、任意の名前の前に "java:comp/env/" を付けるように構成された JndiLocatorDelegate
を作成します。public JndiPropertySource(java.lang.String name, JndiLocatorDelegate jndiLocator)
JndiLocatorDelegate
で新しい JndiPropertySource
を作成します。@Nullable public java.lang.Object getProperty(java.lang.String name)
JndiLocatorDelegate
から指定された名前に関連付けられた値を検索して返します。JndiLocatorDelegate.lookup(String)
の呼び出し中に NamingException
がスローされた場合、null
を返し、例外メッセージを含む DEBUG レベルのログステートメントを発行します。PropertySource<JndiLocatorDelegate>
の getProperty
name
- 検索するプロパティ PropertyResolver.getRequiredProperty(String)