Sora Watermark Remover - Allows you to remove the watermark from Sora videos.Try Now

CurateClick

github.com favicon

ooooo-protocol

一个Java开源库,提供基于接口的声明式方式来对接各种第三方协议(如Dubbo、HTTP),支持动态刷新配置,简化了第三方接口的适配工作。

Check out ooooo-protocol on CurateClick

• Copy the embed code to showcase this product on your website

• Share on X to spread the word about this amazing tool

开源地址 https://github.com/ooooo-youwillsee/ooooo-protocol## ooooo-protocol 提供基于接口的声明式方式来对接第三方接口,支持动态刷新。### 使用示例配置如下:yamlooooo: protocol: # 配置的协议 id demo: # 扫描的包 base-packages: - com.ooooo.protocol.core.service.** # 协议类 (需要自己编写) protocol-class: com.ooooo.protocol.core.request.DemoProtocol # 自定义包装类(需要自己编写),可以用于填充默认参数,校验参数,解析结果 protocol-wrapper-class: - com.ooooo.protocol.core.request.AProtocolWrapper - com.ooooo.protocol.core.request.BProtocolWrapper # 协议的配置 config: a: b实现上述的 DemoProtocol 类:(这里只是简单实现, 复杂可以看 DubboProtocol, HttpProtocol)java@Getterpublic class DemoProtocol implements Protocol { private ProtocolProperties properties; public DemoProtocol(ProtocolProperties properties) { this.properties = properties; } @Override public Object execute(Invocation invocation) throws Throwable { String url = APIServiceContext.getAPIMethodConfig().getUrl(); Object[] args = invocation.getArguments(); String data = null; switch (url) { case HelloService.INVOKE_NORMAL_METHOD: data = (String) args[0]; break; case HelloService.INVOKE_DEFAULT_VALUE: data = ((HelloService.DefaultValueHolder) args[0]).getName(); break; case HelloService.INVOKER_REFRESH_VALUE: data = (String) properties.getConfig().get("a"); break; } return data; }}声明自己的 HelloService 接口:(配置 base-packages 会扫描到这个类,会被自动注册为 springbean,因此可以直接使用 @Autowired)java@APIServicepublic interface HelloService { String INVOKE_NORMAL_METHOD = "HelloService#invokeNormalMethod"; String INVOKE_DEFAULT_VALUE = "HelloService#invokeDefaultValue"; String INVOKER_REFRESH_VALUE = "HelloService#invokerRefreshValue"; @APIMapping(INVOKE_NORMAL_METHOD) String invokeNormalMethod(String name); @APIMapping(INVOKE_DEFAULT_VALUE) String invokeDefaultValue(DefaultValueHolder holder); @APIMapping(INVOKER_REFRESH_VALUE) String invokerRefreshValue(); default String invokeDefaultMethod(String name) { return name + "123"; } default String invokeDefaultMethodForNormalMethod(String name) { return invokeNormalMethod(name); } @Data class DefaultValueHolder { private String name; }}在代码中使用:(这里只是一部分测试类,详细见 DemoProtocolTest)@SpringBootTest(classes = CoreProtocolTestConfiguration.class)public class DemoProtocolTest { @Autowired private ApplicationContext context; @Autowired private AbstractEnvironment environment; @Autowired private APIServiceProtocolPropertiesRefresher refresher; @Test public void testApiService() { HelloService bean = context.getBean(HelloService.class); assertEquals("123", bean.invokeNormalMethod("123")); IAPIService service = (IAPIService) bean; APIServiceConfig apiServiceConfig = service.getAPIServiceConfig(); assertEquals("demo", apiServiceConfig.getProtocolId()); }}### 模块说明1. protocol-core 实现了对接第三方接口的核心逻辑, 2. protocol-dubbo 实现了对 dubbo 接口的适配3. protocol-http 实现了对 http 接口的适配

Latest Weekly Picks

nanobananaimg.com favicon
Weekly Pick

Nano Banana AI Image Generator for Professional Image Creation with Nano Banana Pro Models

Nano Banana
pslscale.com favicon
Weekly Pick

使用 Gemini 3 Pro 分析八字命理

人生 K 线
seedance15.ai favicon
Weekly Pick

Create Cinematic AI Videos from Text or Images with Seedance 1.5

Seedance 1.5 AI
tatted.ai favicon
Weekly Pick

The Tatted AI Tattoo Generator is a tool that allows you to create beautiful custom tattoos within seconds.

Tatted
pslscale.com favicon
Weekly Pick

Discover your PSL (Perceived Sexual Market Value) score with our AI-powered facial analysis

PSL Scale

IPYNB to PDF Converter – Free & Secure

www.reverie.im favicon
Weekly Pick

Dream It, Chat It, Create It

Reverie
make.ink favicon
Weekly Pick

Your AI tattoo generator for pro-grade concepts

make ink