美文网首页
Spring配置原理

Spring配置原理

作者: 明宇Stephen | 来源:发表于2018-09-14 16:34 被阅读0次

    @Configuration, 

    任何一个标注了@Bean的方法, 其返回值将作为一个bean定义注册到Spring的IoC容器, 方法名将默认成该bean定义的id

    @ComponentScan

    @Import

    配置PropertySourcesPlaceholderConfigurer,必须在其他需要读取配置文件的属性来实例化的bean之前实例化,否则其他bean会初始化失败。

    配置PropertySourcesPlaceholderConfigurer

    配置SqlSessionFactory,@Autowired,@Value注解可以用在方法参数里,@Autowired注入的属性必须在改bean之前实例化。

    配置SqlSessionFactory

    配置MapperScannerConfigurer配置MapperFactoryBean

    配置MapperScannerConfigurer

    @MapperScan注解配置MapperFactoryBean

    通过@MapperScan注解

    相关文章

      网友评论

          本文标题:Spring配置原理

          本文链接:https://www.haomeiwen.com/subject/gzxjyftx.html