zoukankan      html  css  js  c++  java
  • 基于注解来装配Bean的属性

    1基于注解配置bean组件扫苗(component scanning):SPring能够从classpath下自动扫描,侦测和实例化

    具体有特定的注解的组建

    特定组件包括:

    -@Component:基本注解,表示了一个受Spring管理的组件

    -@Respositor:标识持久层组件

    -@service:标识服务层(业务层)组件

    —@controller:标识表示层组件

    对于扫描到的组件,Spring有默认的命名策略:使用非限定类名,第一个字母小写。

    也可以在注解中通过value属性值标识组件的名称

    <contex:component-scan>:

    -base-package 属性指定一个需要扫描包及其子类的所有类

    2基于注解配置Bean的属性

  • 相关阅读:
    closure
    运算符优先级
    css妙用
    BFC (块级格式化上下文)
    display:table-cell 详解
    line-height深入理解
    margin collapse
    探究 CSS 解析原理
    python入门
    spring与线程安全
  • 原文地址:https://www.cnblogs.com/wanghongjie/p/4883861.html
Copyright © 2011-2022 走看看