Warning: Attempt to read property "ID" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 471

Warning: Attempt to read property "display_name" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 480

Warning: Attempt to read property "display_name" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 487

Warning: Attempt to read property "description" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 489

Warning: Attempt to read property "ID" on bool in /www/wwwroot/129.28.78.18/wp-content/themes/storeys-pro/wbc/components/og_schema/wb_og_schema.php on line 493

11-23 张森霖

1.property标记

它是bean标记的子标记,用以调用Bean实例中的相关Set方法完成属性值的赋值,从而完成依赖关系的注入。name属性指定Bean实例中的相应属性名称,属性值可通过ref属性或value属性直接指定,也可以通过refvalue子标记指定

<bean id="autoLogBean" class="com.deron.publics.aop.AutoLogBean">
        <property name="propertyBean" ref="propertyBean" />
</bean>
<bean id="propertyBean" class="com.deron.publics.bean.PropertyBean"/>

2.constructor-arg标记

它是bean标记的子标记,用以传入构造参数进行实例化,这也是注入依赖关系的一种常见方式。index属性指定构造参数的序号(从0开始),当只有一个构造参数是通常省略不写;type属性指定构造参数的类型,当为基本数据类型时亦可省略此属性;参数值可通过ref属性或value属性直接指定,也可以通过refvalue子标记指定

3.entry标记

该标记通常用做map标记的子标记,用以设置一个“键/值”对。key属性接收字符串类型的“键”名称,“值”则可由refvalue子标记指定

4、注解:

@Component取代<bean class="">
@Component(“id”) 取代 <bean id="" class="">

评论留言