标签:map www void list springframework org 写法 public
这是一个基本类,++++++++++++++++++++++++++++++++++++++++++
package com.itheima.dao;
import java.lang.reflect.Array;
import java.util.*;
public class BookDaofff {
private int[] array;
private List<String> list;
private Set<String> set;
private Map<String, String> map;
private Properties properties;
public void setArray(int[] array){this.array = array;}
public void setList(List<String> list){this.list = list;}
public void setSet(Set<String> set){this.set = set;}
public void setMap(Map<String,String> map){this.map = map;}
public void setProperties(Properties properties){this.properties = properties;}
public void save(){
System.out.println("array"+ Arrays.toString(array));
System.out.println("list"+list);
System.out.println("set"+set);
System.out.println("map"+map);
System.out.println("properties"+ properties);
}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++配置类+++++++++++++++++++++++++++++++++++++++++++=
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<bean id="BookDaofff" class="com.itheima.dao.BookDaofff">
<property name="array">
<array>
<value>100</value>
<value>200</value>
<value>300</value>
</array>
</property>
<property name="list">
<list>
<value>100</value>
<value>200</value>
<value>300</value>
</list>
</property>
<property name="set">
<set>
<value>100</value>
<value>200</value>
<value>300</value>
</set>
</property>
<property name="map">
<map>
<entry key = "country" value="china"/>
<entry key = "province" value="helan"/>
<entry key = "city" value="xxxxx"/>
</map>
</property>
<property name="properties">
<props>
<prop key = "country" >url</prop>
<prop key = "province">www</prop>
<prop key = "city" >heixxx</prop>
</props>
</property>
</bean>
</beans>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++使用类+++++++++++++++++++++++++++++++++++++++++=
package com.itheima.app;
import com.itheima.dao.BooDao;
import com.itheima.dao.BookDaofff;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Appfor {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext("sp.xml");
BookDaofff bookDao = (BookDaofff) ctx.getBean("BookDaofff");
bookDao.save();
}
}
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++完结演示++++++++++++++++++++++++++++++++++++++++++++++++++++++++2022-7-22
标签:map,www,void,list,springframework,org,写法,public 来源: https://www.cnblogs.com/fgxwan/p/16518790.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。