| 1234567891011121314151617181920212223242526272829 |
- <?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.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
-
- <!-- 自动扫描websocket下的包 -->
- <context:component-scan base-package="com.ncjt.ch.eg.websocket"/>
-
- <!-- 通过spring创建并注入NioEventLoopGroup实例对象 -->
-
- <!-- 用于处理客户端连接请求 -->
- <bean id="bossGroup" class="io.netty.channel.nio.NioEventLoopGroup"/>
-
- <!-- 用于处理客户端I/O操作 -->
- <bean id="workerGroup" class="io.netty.channel.nio.NioEventLoopGroup"/>
-
- <!-- 服务器启动引导类 -->
- <bean id="serverBootstrap" class="io.netty.bootstrap.ServerBootstrap" scope="prototype"/>
-
- <!-- 将WebSocket服务器线程作为bean托管给spring创建 -->
- <!-- spring负责创建该类实例对象,并通过依赖注入对对象的成员变量进行赋值 -->
- <bean id="webSocketServer" class="com.ncjt.ch.eg.websocket.WebSocketServerThread">
- <property name="port" value="7070"/>
- <property name="childChannelHandler" ref="egChildHandler" />
- </bean>
- </beans>
|