您的位置:首页 > 编程语言 > Java开发

Java开发框架--spring-mvc.xml 配置详解

2017-03-10 23:07 651 查看
<?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-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!--引入配置属性文件 http://blog.csdn.net/happy_wu/article/details/60965959--> <context:property-placeholder location="classpath:config.properties"
ignore-unresolvable="true" />

<!--自动扫描含有@Service将其注入为bean 既然spring-servlet.xml中已经配置过了,为什么这里还是要配置?-->
<context:component-scan base-package="com.app.service">

</context:component-scan>
<!--用于高并非,多线程。可被池化的对象的配置。 http://blog.csdn.net/chaofanwei2/article/details/51291401--> <bean name="genericObjectPoolConfig" class="org.apache.commons.pool2.impl.GenericObjectPoolConfig">
<property name="maxWaitMillis" value="-1" /><!--maxWaitMillis:从idle队列里面取对象时,若阻塞的话,则最大等待时长-->
<property name="maxTotal" value="1000" />
<property name="minIdle" value="8" />
<property name="maxIdle" value="100" />
</bean>

<!-- redis集群 -->
<bean id="jedisCluster" class="com.app.redis.JedisClusterFactory">
<property name="addressConfig">
<value>classpath:config.properties</value>
</property>
<property name="addressKeyPrefix" value="address" /> <!-- 属性文件里 key的前缀 -->

<property name="timeout" value="300000" />
<property name="maxRedirections" value="6" />
<property name="genericObjectPoolConfig" ref="genericObjectPoolConfig" />
</bean>
</beans>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: