Archived
0

переход на groovy конфигурацию

This commit is contained in:
2019-02-17 23:26:03 +03:00
parent f08190fba7
commit 72c24b2adf
17 changed files with 198 additions and 211 deletions

View File

@@ -2,6 +2,6 @@
Реализация протокола на сетевом движке [Netty.IO](https://netty.io/).
Пример настройки можно посмотреть в файле `sample-config.xml`
Пример настройки можно посмотреть в файле [`sample-config.groovy`](./sample-config.groovy)

View File

@@ -0,0 +1,18 @@
beans {
xmlns([context: 'http://www.springframework.org/schema/context'])
context.'annotation-config'()
context.'component-scan'('base-package': 'mc.core.network.proto_1_12_2.netty')
/* Для логирования сетевых пакетов, можно добавить нижезакомментированный бин */
//'pipeline.log'(io.netty.handler.logging.LoggingHandler) { bean -> bean.scope = 'prototype' }
'pipeline.decoder'(mc.core.network.proto_1_12_2.netty.PacketDecoder) { bean -> bean.scope = 'prototype' }
'pipeline.postencoder'(mc.core.network.proto_1_12_2.netty.PacketPostEncoder) { bean -> bean.scope = 'prototype' }
'pipeline.encoder'(mc.core.network.proto_1_12_2.netty.PacketEncoder) { bean -> bean.scope = 'prototype' }
'pipeline.handler'(mc.core.network.proto_1_12_2.netty.PacketHandler) { bean -> bean.scope = 'prototype' }
server(mc.core.network.proto_1_12_2.netty.NettyServer) {
host = '127.0.0.1'
port = 25565
workerGroupCount = 2
}
}

View File

@@ -1,24 +0,0 @@
<?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-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config />
<context:component-scan base-package="mc.core.network.proto_1_12_2.netty" />
<!-- Для логирования сетевых пакетов, можно добавить нижезакомментированный бин -->
<!-- <bean id="pipeline.log" class="io.netty.handler.logging.LoggingHandler" scope="prototype"/> -->
<bean id="pipeline.decoder" class="mc.core.network.proto_1_12_2.netty.PacketDecoder" scope="prototype"/>
<bean id="pipeline.postencoder" class="mc.core.network.proto_1_12_2.netty.PacketPostEncoder" scope="prototype"/>
<bean id="pipeline.encoder" class="mc.core.network.proto_1_12_2.netty.PacketEncoder" scope="prototype"/>
<bean id="pipeline.handler" class="mc.core.network.proto_1_12_2.netty.PacketHandler" scope="prototype"/>
<bean id="server" class="mc.core.network.proto_1_12_2.netty.NettyServer">
<property name="host" value="127.0.0.1"/>
<property name="port" value="25565"/>
<property name="workerGroupCount" value="2"/>
</bean>
</beans>