容器扩展

容器扩展

扩展说明

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

扩展接口

org.apache.dubbo.container.Container

扩展配置

  1. java org.apache.dubbo.container.Main spring jetty log4j

已知扩展

  • org.apache.dubbo.container.spring.SpringContainer
  • org.apache.dubbo.container.spring.JettyContainer
  • org.apache.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. |-org.apache.dubbo.container.Container (纯文本文件,内容为:xxx=com.xxx.XxxContainer)

XxxContainer.java:

  1. package com.xxx;
  2. org.apache.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/org.apache.dubbo.container.Container:

  1. xxx=com.xxx.XxxContainer

最后修改 March 2, 2023: Fix alias forward in docs3-v2 (#2342) (f16c1535592)