Spring面试
1、使用xml方式来声明Bean的定义,Spring容器在启动的时候会加载并解析这个xml,把bean装载到IOC容器中。
2、使用@CompontScan注解来扫描声明@Contrller、@Service、@Repository、@Component注解类,加载到IOC容器中。
3、使用@Configuration注解声明配置类,并使用@Bean注解实现Bean的定义,这种方式其实是xml配置方式的一种演变,是Spring迈入到无配置化时代的里程碑。
4、使用@import注解,导入配置类或者普通bean。
5、使用FactoryBean工厂bean,动态构建一个Bean实例,Spring Cloud OpenFeign里面的动态代理实例就是使用FactoryBean来实现的。
6、实现ImportBeanDefinition-Registrar接口,可以动态注入Bean实例。这个在Spring Boot里面的启动注解有用到。

浙公网安备 33010602011771号