2
我有一個註釋,不包括其他幾個註解,很像這樣一個位置:的Java:註解註釋(和值傳遞)
@Component // Spring Component
@Interface OsgiService { boolean isFactory() }
這意味着與@OsgiService
註釋的所有類應自動也被標註爲@Component
。哪些工作正常。
但是,現在我想添加另一個註釋,它的參數取決於isFactory
參數@OsgiService
。
@Component // Spring Component
@Scope(isFactory() ? "prototype" : "singleton")
@Interface OsgiService { boolean isFactory() }
哪一個不行。但是,作爲註釋的isFactory
屬性需要是一個靜態值,難道不應該有這樣的東西嗎?