applicationContext.xml文件中<bean>标签中property属性用法说明
2018-10-13 18:25
746 查看
<bean name="useraaa" class="com.maple.bean.User"> <property name="name"> <value>小强</value> </property> <property name="age"> <value>26</value> </property> <property name="sex"> <value>男</value> </property> </bean> <bean id="/main.do" class="com.maple.main.Manger"> <property name="userinfo"> <ref bean="useraaa"/> </property> </bean>
上述代码中:
property标签的name属性是指bean标签中class属性的类中的私有属性名,
如果该属性的值是引用的其它bean,那么就不能用value标签,而是ref标签
<ref bean="xml中定义的bean的id或name名称"/>
如果该属性的值引用了匿名内部类,则直接使用bean标签即可(不指定id或name属性)
<bean class="com.test.Student" />
相关文章推荐
- Spring的applicationContext配置文件中<bean>标签的属性说明
- Android系统开发 - 扩展Androidmanifest.xml文件中<application>标签的属性
- 使用<context:property-placeholder>标签导入多个properties文件
- Spring ApplicationContext.xml配置的12个技巧和Bean属性说明
- pom.xml文件中<dependencyManagement>标签说明
- Spring配置文件<context:property-placeholder>标签使用漫谈
- Spring配置文件元素<context:property-placeholder location="classpath:application.properties" />
- Spring配置文件<context:property-placeholder>标签使用漫谈
- Spring配置文件<context:property-placeholder>标签使用漫谈
- spring applicationContext.xml 文件中<context:component-scan/>使用详解
- android Manifest.xml全局配置文件中根标签中package属性及<original-package>标签注意点
- Spring配置文件<context:property-placeholder>标签使用
- Spring配置文件<context:property-placeholder>标签使用漫谈
- Spring的配置文件applicationContext.xml中的 <context:component-scan base-package="com.orm" />
- Spring配置文件<context:property-placeholder>标签使用漫谈
- Spring配置文件<context:property-placeholder>标签,每个配置文件中只能实用一次
- Spring ApplicationContext.xml配置的12个技巧和Bean属性说明
- Spring ApplicationContext.xml配置的12个技巧和Bean属性说明
- Spring配置文件<context:property-placeholder>标签使用漫谈
- 使用<context:property-placeholder>标签导入多个properties文件