以下は For Component Interface のソースコードです
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Component {
Spring Controller アノテーションの場合は以下のとおりです。
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Controller {
@Component が Controller アノテーションに追加されるのはなぜですか? その目的は何ですか?この行を削除するとどうなりますか?
カスタム注釈の作成に使用される以下の注釈タイプについては明確です。
@Documented Whether to put the annotation in Javadocs
@Retention When the annotation is needed
@Target Places the annotation can go
@Inherited Whether subclasses get the annotation