Mina框架与Spring整合配置文件
Mina框架与Spring的整合事实上非常easy,主要是要弄清楚要注入的属性的名称,进而选择合适的注入方法。
关于Spring的四种注入方法请还有一篇文章:spring依赖注入的四种方式
<?xml version="1.0" encoding="UTF-8"?>
<beansxmlns="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.xsd">
<!-- 业务处理逻辑 -->
<bean />
<!-- 累加数据包解码器:解断丢包、粘包问题 -->
<bean >
<!-- 多线程处理过滤器,为后面的操作开启多线程,一般放在编解码过滤器之后,開始业务逻辑处理 -->
<bean />
<!-- Mina自带日志过滤器 默认级别为debug -->
<bean >
<property name="messageReceivedLogLevel" ref="info"></property>
<property name="exceptionCaughtLogLevel" ref="info"></property>
</bean>
<!-- 枚举类型 依赖注入 须要先通过此类进行类型转换-->
<bean >
<property name="staticField" value="org.apache.mina.filter.logging.LogLevel.INFO" />
</bean>
<bean ><!-- session config 通过工厂方法注入 -->
<bean >
<property name="readerIdleTime" value="10"/>
<property name="minReadBufferSize" value="512"/>
<property name="maxReadBufferSize" value="10240"/>
</bean>
<bean ></bean>
</beans>