可以被继承 首先注解在类上是可以被继承的 在注解上用@Inherited /** * Created by laizhenwei on 17:49 2017-10-14 */ @Target({ElementType.TYPE,ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface Mark { String desc() default ""; } 注解在方法上(jdk…
手动获取容器对象时,报no qualifying bean of type is defined, 经过调查,发现手动获取的时候,该类所在的包必须经过spring容器初始化. 1.SpringConfigHolder 代码,添加@Component进行ioc package com.xxxxxxx.utils.holder; import org.springframework.beans.BeansException; import org.springframework.context.Ap…