容器扩展

扩展说明

服务容器扩展,用于自定义加载内容。

扩展接口

com.alibaba.dubbo.container.Container

扩展配置

  1. java com.alibaba.dubbo.container.Main spring jetty log4j

已知扩展

  • com.alibaba.dubbo.container.spring.SpringContainer
  • com.alibaba.dubbo.container.spring.JettyContainer
  • com.alibaba.dubbo.container.spring.Log4jContainer

    扩展示例

Maven 项目结构:

  1. src
  2. |-main
  3. |-java
  4. |-com
  5. |-xxx
  6. |-XxxContainer.java (实现Container接口)
  7. |-resources
  8. |-META-INF
  9. |-dubbo
  10. |-com.alibaba.dubbo.container.Container (纯文本文件,内容为:xxx=com.xxx.XxxContainer)

XxxContainer.java:

  1. package com.xxx;
  2. com.alibaba.dubbo.container.Container;
  3. public class XxxContainer implements Container {
  4. public Status start() {
  5. // ...
  6. }
  7. public Status stop() {
  8. // ...
  9. }
  10. }

META-INF/dubbo/com.alibaba.dubbo.container.Container:

  1. xxx=com.xxx.XxxContainer

原文: http://dubbo.apache.org/#!/docs/dev/impls/container.md?lang=zh-cn