这个找了很久,一直想用这个功能,在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的更多相关文章

  1. spring配置文件中配置sessionFactory失败

    配置失败主要原因有两个: <bean id="studentDaoImp" class="com.gxwuz.maven.dao.StudentDaoImp&quo ...

  2. Spring基础——在Spring Config 文件中配置 Bean

    一.基于 XML 的 Bean 的配置——通过全类名(反射) <bean <!-- id: bean 的名称在IOC容器内必须是唯一的若没有指定,则自动的将全限定类名作为 改 bean 的 ...

  3. spring 3配置文件中如何注入map list set等类型

    首先写个 javabean类吧,如下 package com.bean; import java.util.List; import java.util.Map; import java.util.P ...

  4. spring boot rest 接口集成 spring security(2) - JWT配置

    Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...

  5. log4net保存到数据库系列二:独立配置文件中配置log4net

    园子里面有很多关于log4net保存到数据库的帖子,但是要动手操作还是比较不易,从头开始学习log4net数据库日志一.WebConfig中配置log4net 一.WebConfig中配置log4ne ...

  6. spring xml 配置文件中标签的解析

    一个springmvc配置文件的例子为: <?xml version="1.0" encoding="UTF-8"?> <beans xmln ...

  7. spring 将配置文件中的值注入 属性

    1.编写配置文件 #债权转让 #默认周期 必须大于0 credit.defaultDuration=1 #最小转让金额(元) credit.minBidAmount=1.00 #最小转让时间 到期时间 ...

  8. Spring Boot 配置文件中的花样,看这一篇足矣!

    在快速入门一节中,我们轻松的实现了一个简单的RESTful API应用,体验了一下Spring Boot给我们带来的诸多优点,我们用非常少的代码量就成功的实现了一个Web应用,这是传统的Spring应 ...

  9. Spring Boot 配置文件中的花样

    原文:https://www.cnblogs.com/didispace/p/11002732.html 在快速入门一节中,我们轻松的实现了一个简单的RESTful API应用,体验了一下Spring ...

随机推荐

  1. ASP.NET中的URL编码解码(转)

    在对URL进行编码时,该用哪一个?这两都使用上有什么区别吗?测试: string file="文件上(传)篇.doc";string Server_UrlEncode=Server ...

  2. 安装64位的oracle数据库, 使用自带的sqldeveloper

    个人感觉这个东西比plsql要好用, 虽然界面有点丑, 整个使用与plsql也没多大区别, 这里是他的位置C:\oracle_11g\product\11.2.0\dbhome_1\sqldevelo ...

  3. centos 系统下查看时间时区以及修改

    1.系统时间查看及修改: Centos 6 查看系统时间:# date

  4. 各种语言使用HTTP Request

    1. JAVA String requestContent = "{"id":"1","sort":"des" ...

  5. QT隐式数据共享

    QT中许多C++类使用了隐式数据共享,最小化资源拷贝.当作为参数传递时,实际只传递了指针,这是底层完成的,程序员无需担心,即使是在多线程中,从Qt4开始: 记住,尽量使用const迭代器,vector ...

  6. [leetcode]199. Binary Tree Right Side View二叉树右侧视角

    Given a binary tree, imagine yourself standing on the right side of it, return the values of the nod ...

  7. Mongodb相对于关系型数据库的优缺点(转)

    与关系型数据库相比,MongoDB的优点: ①弱一致性(最终一致),更能保证用户的访问速度: 举例来说,在传统的关系型数据库中,一个COUNT类型的操作会锁定数据集,这样可以保证得到“当前”情况下的精 ...

  8. Sql优化-必劳记!

    0. 尝试在合适的场景下,用 Charindex()函数代替 like,或者全文索引进行 内容搜寻.%like%不走索引,'like%'后百分号可以走索引. 1.调整不良SQL通常可以从以下几点切入: ...

  9. .NET获得上传图片宽高

    代码: //图片大小限制--------------------------- System.Drawing.Image txtStoryimage = System.Drawing.Image.Fr ...

  10. asp.net core web 本地iis开发

    发布后打开没有问题,直接配置到本地iis时,会提示如下错误 HTTP Error 502.5 - Process Failure