My apache application sit inside a Spring context.
<bean id="ghChatServer" class="io.gamehammer.service.ghchat.server.GhChatServer"
init-method="init" destroy-method="destroy">
<property name="port" value="5222" />
</bean>
And the handler also inside the container.
<bean id="eventHandler" class="io.gamehammer.service.ghchat.handler.EventHandler"></bean>
Where the sessionCreate, it will create a new worker and put it inside a HashMap. Remove it when it disconnect.
@Override
public void sessionCreated(IoSession session) throws Exception {
sessionWorker = new SessionWorker();
sessionHandler.init(session);
cpntext.put(session, sessionHandler);
log.info("Current connected session : " + handlers.size());
}
I can inject bean in to my handler. But I want to inject service into my Worker too. How can I dynamic create a bean when sessionCreated in my handler is call?
Is it possible to implement my own scope like HttpSession scope by default?