参考手册报告:
如果在 as-install/modules 的 JAR 文件中找到域定制器
运行 create-domain 子命令时的目录,定制器
被处理。域定制器是一个实现
DomainInitializer 接口。
我确实没有找到有关自定义的文档,但根据源代码,我可以确定域初始化程序用于在域创建期间自定义 domain.xml。
package org.glassfish.api.admin.config;
import org.jvnet.hk2.annotations.Contract;
import org.glassfish.api.admin.config.Container;
/**
* Marker interface to mark inhabitants that require some minimal initial
* configuration to be inserted into a newly create domain's domain.xml
*
* @author Nandini Ektare
*/
@Contract
public interface DomainInitializer {
/**
* The actual initial config that needs to be inserted into
* the fresh domain.xml
*
* See {@link Attribute#value()} for how the default value is inferred.
*
*/
public <T extends Container> T getInitialConfig(DomainContext initialCtx);
}
您可以找到来源here。
getInitialConfig 方法返回一个Container 实例。 Container 接口扩展了org.jvnet.hk2.config.ConfigBeanProxy 接口,似乎是Dom 类的代理:
/**
* Marker interface that signifies that the interface
* is meant to be used as a strongly-typed proxy to
* {@link Dom}.
*
* <p>
* To obtain the Dom object, use {@link Dom#unwrap(ConfigBeanProxy)}.
* This design allows the interfaces to be implemented by other code
* outside DOM more easily.
*
* @author Kohsuke Kawaguchi
* @see Dom#unwrap(ConfigBeanProxy)
* @see DuckTyped
* @see Element
* @see Attribute
*/
public interface ConfigBeanProxy {
我发现hk2 是了解域自定义如何工作的关键。
希望其他人能给你一些更有用的信息。