Cola拓展点架构设计
2023-08-01 08:47:49 1 举报
Cola拓展点架构设计
作者其他创作
大纲/内容
classAbstractComponentExecutor
ExtensionBootstrap
- ExtensionRegister extensionRegister- ApplicationContext applicationContext
+ init()
此处实现执行拓展点
依赖拓展点仓库注册拓展点
extensionRegister.doRegistrationExtensions((ExtensionPointI) extension))
ExtensionRepository
+ String EXTENSION_INTERFACE_NAME_ILLEGAL = \"extension_interface_name_illegal\"; 扩展点接口名称不合法+ String EXTENSION_ILLEGAL = \"extension_illegal\"; //扩展点不合法+ String EXTENSION_DEFINE_DUPLICATE = \"extension_define_duplicate\"; //扩展点定义重复- ExtensionRepository extensionRepository;+ String EXTENSION_EXTPT_NAMING = \"ExtPt\";
+ doRegistration(ExtensionPointI extensionObject)+ void doRegistrationExtensions(ExtensionPointI extensionObject)
ExtensionRegister
classCustomicExtension1
@Extension()
1applicationContext.getBeansWithAnnotation(Extension.class)2、foreach#doRegistration
interfaceExtensionPointI
spring.factories
1applicationContext.getBeansWithAnnotation(Extensions.class);2、foreach#doRegistrations
- ExtensionRepository extensionRepository;
注册实际存放位置
@interfaceExtensions
+ String[] bizId+ String[] useCase+ String[] scenario+ Extension[] value
init
extensionRegister.doRegistration((ExtensionPointI) extension)
/* * Copyright 2017 Alibaba.com All right reserved. This software is the * confidential and proprietary information of Alibaba.com (\"Confidential * Information\"). You shall not disclose such Confidential Information and shall * use it only in accordance with the terms of the license agreement you entered * into with Alibaba.com. */package com.alibaba.cola.extension;import com.alibaba.cola.extension.register.AbstractComponentExecutor;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.stereotype.Component;import javax.annotation.Resource;/** * ExtensionExecutor * * @author fulan.zjf 2017-11-05 */@Componentpublic class ExtensionExecutor extends AbstractComponentExecutor { private static final String EXTENSION_NOT_FOUND = \"extension_not_found\
启动脚手架 @BeanExtensionAutoConfiguration
classCustomicExtension2
@interfaceExtension
+ String bizId+ String useCase+ String scenario
classExtensionExecutor
- ExtensionRepository extensionRepository
SpringbootSPI启动
spring spi启动扫描器,扫描拓展点
ExtensionExecutor
核心实现逻辑
0 条评论
下一页