Mina集成Spring --- 在配置文件中配置sessionconfig
这个找了很久,一直想用这个功能,在xml里,配置如下:
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <!-- basic config-->
<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="java.net.SocketAddress" value="org.apache.mina.integration.beans.InetSocketAddressEditor">
</entry>
</map>
</property>
</bean> <!-- handler -->
<bean id="SimpleHandler" class="com.server.handler.TestHandler" /> <!-- session config -->
<bean id="sessionConfig" factory-bean="ioAcceptor" factory-method="getSessionConfig" >
<property name="bothIdleTime" value="10"/>
<property name="readBufferSize" value="2048" /> </bean> <!-- filter chain -->
<bean id="filterChainBuilder"
class="org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder">
<property name="filters">
<map>
<entry key="executor">
<bean class="org.apache.mina.filter.executor.ExecutorFilter" />
</entry>
<entry key="codec">
<bean class="org.apache.mina.filter.codec.ProtocolCodecFilter">
<constructor-arg>
<bean class="com.server.codec.basic.BasicFactory" />
</constructor-arg>
</bean>
</entry>
<entry key="logging">
<bean class="org.apache.mina.filter.logging.LoggingFilter" />
</entry>
</map>
</property>
</bean> <!-- ioAcceptor -->
<bean id="ioAcceptor" class="org.apache.mina.transport.socket.nio.NioSocketAcceptor"
init-method="bind" destroy-method="unbind" >
<property name="defaultLocalAddress" value=":8888" />
<property name="handler" ref="SimpleHandler" />
<property name="filterChainBuilder" ref="filterChainBuilder" />
<property name="reuseAddress" value="true" />
</bean> </beans>
Mina集成Spring --- 在配置文件中配置sessionconfig的更多相关文章
- spring配置文件中配置sessionFactory失败
配置失败主要原因有两个: <bean id="studentDaoImp" class="com.gxwuz.maven.dao.StudentDaoImp&quo ...
- Spring基础——在Spring Config 文件中配置 Bean
一.基于 XML 的 Bean 的配置——通过全类名(反射) <bean <!-- id: bean 的名称在IOC容器内必须是唯一的若没有指定,则自动的将全限定类名作为 改 bean 的 ...
- spring 3配置文件中如何注入map list set等类型
首先写个 javabean类吧,如下 package com.bean; import java.util.List; import java.util.Map; import java.util.P ...
- spring boot rest 接口集成 spring security(2) - JWT配置
Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...
- log4net保存到数据库系列二:独立配置文件中配置log4net
园子里面有很多关于log4net保存到数据库的帖子,但是要动手操作还是比较不易,从头开始学习log4net数据库日志一.WebConfig中配置log4net 一.WebConfig中配置log4ne ...
- spring xml 配置文件中标签的解析
一个springmvc配置文件的例子为: <?xml version="1.0" encoding="UTF-8"?> <beans xmln ...
- spring 将配置文件中的值注入 属性
1.编写配置文件 #债权转让 #默认周期 必须大于0 credit.defaultDuration=1 #最小转让金额(元) credit.minBidAmount=1.00 #最小转让时间 到期时间 ...
- Spring Boot 配置文件中的花样,看这一篇足矣!
在快速入门一节中,我们轻松的实现了一个简单的RESTful API应用,体验了一下Spring Boot给我们带来的诸多优点,我们用非常少的代码量就成功的实现了一个Web应用,这是传统的Spring应 ...
- Spring Boot 配置文件中的花样
原文:https://www.cnblogs.com/didispace/p/11002732.html 在快速入门一节中,我们轻松的实现了一个简单的RESTful API应用,体验了一下Spring ...
随机推荐
- 让IIS支持PHP的配置步骤
本文转自:http://marsren.blog.51cto.com/116511/41199/ 在Windows Server 2003的IIS6下配置ISAPI方式的PHP,配置方法是,在IIS的 ...
- 删除Eclipse已有的SVN资源库位置
点击Eclipse菜单栏的[Window]->[Show View]->[Other],在弹出的对话框中,选择[SVN]->[SVN资源库],然后点击[OK]. 接着,在Eclips ...
- 整合Struts2框架和Spring框架
-----------------------siwuxie095 整合 Struts2 框架和 Spring 框架 1 ...
- 关于"undefined reference"错误
这个错误换句话说: 链接的时候找不到实现的文件(谨记从这个入手!). 可能导致的原因有: 1. 没有链接库文件,包括静态库或动态库. 2. 链接文件的顺序问题,先后依赖问题,把被依赖的放后面. 3. ...
- VMware安装win7:units specified don't exist问题
主要是磁盘接口不匹配,调整CD/DVD和硬件磁盘接口, CD/DVD调整成IDE,硬盘调整成SATA即可. 提示system not found,主分区没有激活,进入disgenius,会提示修正,保 ...
- 【校招面试 之 C/C++】第30题 C++ 11新特性(一)之auto关键字
1.自动类型推断 auto自动类型推断,用于从初始化表达式中推断出变量的数据类型.通过auto的自动类型推断,可以大大简化我们的编程工作.下面是一些使用auto的例子. #include <ve ...
- windows常用运行命令总结
开始→运行→命令集锦 winver---------检查Windows版本 wmimgmt.msc----打开windows管理体系结构(WMI) wupdmgr--------windows更新程序 ...
- OpenSSL基础知识
1.openssl里的fips是什么意思? openssl-fips是符合FIPS标准的Openssl. 联邦信息处理标准(Federal Information Processing Standar ...
- db2 统计信息 runstats
1.runstats的语法:runstats on table [模式名].[表名] with distribution and detailed indexes all注意:你可以在所有列上,或者仅 ...
- [PHP] 转义字符 Escape character
\n is a symbol for new line \t is a symbol for tab and \r is for 'return'