Class<?>
は、バインドされていないワイルドカードを使用するジェネリックタイプです。それは "Class<Foo>
いくつかのタイプのFoo"を意味します。 ClassPathXmlApplicationContextコンストラクタパラメータclazzは、クラスを使用してリソースをロードします(指定されたパスの基礎)。
/**
* Create a new ClassPathXmlApplicationContext, loading the definitions
* from the given XML file and automatically refreshing the context.
* <p>This is a convenience method to load class path resources relative to a
* given Class. For full flexibility, consider using a GenericApplicationContext
* with an XmlBeanDefinitionReader and a ClassPathResource argument.
* @param path relative (or absolute) path within the class path
* @param clazz the class to load resources with (basis for the given paths)
* @throws BeansException if context creation failed
* @see org.springframework.core.io.ClassPathResource#ClassPathResource(String, Class)
* @see org.springframework.context.support.GenericApplicationContext
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader
*/
public ClassPathXmlApplicationContext(String path, Class clazz) throws BeansException {
this(new String[] {path}, clazz);
}
私はこのjavadocの詳細を探しています。 ClasspathXmlApplicationContextのコンテキストでは、これはどのような種類のリソースですか?ここで、「特定のクラスとの相対的」とはどういう意味ですか?好ましくは、いくつかの文書の例または参照を詳述してください。 返信いただきありがとうございます! – Forumer