`
flashing
  • 浏览: 349882 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

netty和spring集成,没什么神秘的

阅读更多

Here's an example code that gets an instance of ServerSocketChannelFactory:

        ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
                new String[] {"com/example/myapp/spring-beans.xml" }); // spring-beans.xml imports Netty beans.xml.

        channelFactory = (ServerSocketChannelFactory) context.getBean(ServerSocketChannelFactory.class.getName());
        // ...
        context.close();

Please note all container integration layers registers all ChannelFactories with the same bean ID (or service name) so that you can easily switch from one technology to the other.

 

其实说白了,多用get/set来组装对象,什么都能和spring集成,ioc容器的核心。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics