Java で注釈ベースの初期化メカニズムを実装したいと考えています。具体的には、定義した注釈があります。
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Initialization {
/**
* If the eager initialization flag is set to <code>true</code> then the
* initialized class will be initialized the first time it is created.
* Otherwise, it will be initialized the first time it is used.
*
* @return <code>true</code> if the initialization method should be called
* eagerly
*/
boolean eager() default false;
}
さらに、私はインターフェースを持っています:
public interface SomeKindOfBasicInterface {}
メソッドに注釈SomeKindOfBasicInterface
があるクラスパス上のクラスのすべての実装を見つけたいです。これを行っている間、他の実装のロードを延期する最良の方法のように見える@Initialization
Springのツールを見ています...しかし、私が説明しているような検索を行う方法がわかりません。任意のヒント?MetaDataReader
SomeKindOfBasicInterface