Spring使用技巧
来源:互联网 发布:真人cs漆弹枪淘宝店 编辑:程序博客网 时间:2024/05/17 21:50
1.注入List类型值protected List<String> supportCodes;public void setSupportCodes(List<String> supportCodes) {this.supportCodes = supportCodes;}public boolean support(String productCode) {if(null == supportCodes || supportCodes.isEmpty()) {return false;}for(String code : supportCodes) {if(code.equals(productCode)) {return true;}}return false;}xml如下: <property name="supportCodes"><list><value>FI16006</value><value>FI16005</value><value>FI16004</value></list></property>2.注入Map类型值 private Map<String, String> instProductPos; <bean id= "instProductPos" class ="java.util.HashMap"> <constructor-arg> <map> <entry key= "Funds" value="com.payment.lc.pcs.po.ProductionFundsPo" /> <entry key= "Insurance" value="com.payment.lc.pcs.po.ProductionInsurancePo" /> <entry key= "YueGuJiao" value="com.payment.lc.pcs.po.ProductionYueGuJiaoPo" /> </map> </constructor-arg> </bean > private Map<String, MemcachedClient> clientMap; <bean id= "pcsMemeryCacheClient" class="com.payment.lc.pcs.cache.impl.MemeryCacheClient" > <property name= "clientMap"> <map> <entry key= "production"> <ref bean= "pcsMemeryClient" /> </entry> </map> </property> </bean>3.注入threadPoolTaskExecutor(建议勿对更新操作使用)threadPoolTaskExecutor.execute(new Runnable() { public void run() { //处理 } });<bean id="threadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <property name="corePoolSize" value="5" /> <property name="maxPoolSize" value="20" /> <property name="queueCapacity" value="200" /> <property name="keepAliveSeconds" value="300" /> <property name="rejectedExecutionHandler"> <bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy" /> </property> </bean>
4.注入List值<property name="accountIdList"> <list> <value>70000001</value> </list> </property>
0 0
- Spring使用技巧
- Spring使用技巧
- Spring Web MVC使用技巧一则
- Spring [boot] 使用技巧集合-不断积累
- 超详细 Spring @RequestMapping 注解使用技巧
- jsp使用spring的bean的小技巧
- STS(Spring Tool Suite)使用小技巧记录
- Spring MVC学习总结(6)——一些Spring MVC的使用技巧
- 【技巧】UE使用技巧
- Spring XML配置技巧
- Spring XML配置技巧
- spring+多线程小技巧
- ESFramewor使用技巧(3) -- 在插件中使用Spring.net
- 使用技巧
- 一则spring中使用PropertyEditors 来注入日期型属性的技巧
- Spring MVC的使用技巧(APP验证 加密/解密Json 敏感词过滤)
- eclipse使用技巧:技巧汇总
- Spring技巧之简洁配置
- spring报错“Failed to import bean definitions from relative location
- X-Plane 10 wing flex dataref
- permission denied for this window type
- 网络通信错误码转换
- PCB布局,布线技巧总结
- Spring使用技巧
- WebService技术总结(一):jdk自带的WebService API:jaxws
- JPA用法
- 岁末-2016
- 欢迎使用CSDN-markdown编辑器
- SNMP高速扫描器braa
- 冒泡排序
- POJ 1830 开关问题(高斯消元法)
- Angular双向数据绑定