Spring MVC整合MINA配置
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:property-placeholder location="classpath*:mina.properties" ignore-unresolvable="true"/>
<!--mina server-->
<bean id="serverHandler" class="com.yuchengtech.vtfileweb.socket.ServerHandler">
</bean>
<!--executorFilter 多线程处理-->
<bean id="executorFilter" class="org.apache.mina.filter.executor.ExecutorFilter">
<constructor-arg index="0" value="${mina.initPoolSize}" />
<constructor-arg index="1" value="${mina.maximumPoolSize}"/>
</bean>
<bean id="mdcInjectionFilter" class="org.apache.mina.filter.logging.MdcInjectionFilter">
<constructor-arg value="remoteAddress"/>
</bean>
<bean id="codecFilter" class="org.apache.mina.filter.codec.ProtocolCodecFilter">
<constructor-arg>
<bean class="com.yuchengtech.vtfileweb.socket.ServerCodeFactory"/>
</constructor-arg>
</bean>
<bean id="loggingFilter" class="org.apache.mina.filter.logging.LoggingFilter"/>
<bean id="filterChainBuilder" class="org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder">
<property name="filters">
<map>
<entry key="executor" value-ref="executorFilter"/>
<entry key="mdcInjectionFilter" value-ref="mdcInjectionFilter"/>
<entry key="codecFilter" value-ref="codecFilter"/>
<entry key="loggingFilter" value-ref="loggingFilter"/>
</map>
</property>
</bean>
<!-- session config -->
<bean id="sessionConfig" factory-bean="ioAcceptor"
factory-method="getSessionConfig" >
<property name="bothIdleTime" value="10"/>
<property name="receiveBufferSize" value="1024"/>
<property name="sendBufferSize" value="1024"/>
</bean>
<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="java.net.SocketAddress">
<bean class="org.apache.mina.integration.beans.InetSocketAddressEditor"/>
</entry>
</map> decorator
</property>
</bean>
<bean id="ioAcceptor" class="org.apache.mina.transport.socket.nio.NioSocketAcceptor" init-method="bind" destroy-method="unbind">
<property name="defaultLocalAddress" value="${mina.port}"/>
<property name="handler" ref="serverHandler"/>
<property name="filterChainBuilder" ref="filterChainBuilder"/>
<property name="reuseAddress" value="true"/>
<!-- <property name="backlog" value="100"/> -->
</bean>
</beans>
Spring MVC整合MINA配置
最新推荐文章于 2025-03-03 00:13:46 发布