Springboot注解,spring4筆記----spring4構造注入

 2023-10-08 阅读 29 评论 0

摘要:與設值注入有以下不同,顏色標出 package com.ij34.web; import com.ij34.servce.people; import com.ij34.servce.root;public class chinese implements people{private root dog;public root getDog() {return dog;}/* public void setDog(root dog) {this.dog =

與設值注入有以下不同,顏色標出

package com.ij34.web;
import com.ij34.servce.people;
import com.ij34.servce.root;public class chinese implements people{private root dog;public root getDog() {return dog;}/*    public void setDog(root dog) {this.dog = dog;}*/public chinese(root dog) {this.dog = dog;}@Overridepublic void cut() {// TODO Auto-generated method stubSystem.out.println("我是中國人");System.out.println(dog.chop());}}

?


<?xml version="1.0" encoding="GBK"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://www.springframework.org/schema/beans"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.3.xsd"><bean id="chinese" class="com.ij34.web.chinese">
<!--  <property name="dog" ref="iron"></property>--><constructor-arg ref="iron" type="com.ij34.servce.root"></constructor-arg></bean><bean id="stone" class="com.ij34.web.stonechop"></bean><bean id="iron" class="com.ij34.web.ironchop"></bean>
</beans>

Springboot注解、?


?

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/131455.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息