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容器的核心。