本文介绍了如何将Java内设置骆驼背景和注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个独立的CAMEL应用。我希望只使用Java的(因为编译器会告诉什么是错)。
为了使我的code少耦合,并通过试验可重复使用的,我想脱钩环境和注册表来分隔类的创建。
我刚开始延长 DefaultCamelContext - 这是一个好主意,或者我应该扩展/实现一些其它的类?
在这一类我想用我自己的注册表(它结合了一些bean实例)类。我找到方法setRegistry(org.apache.camel.spi.Registry)。

I am creating a stand alone camel application. I want to use only java (because the compiler tells whats wrong).To make my code less coupled and reusable by tests i want to decouple the creation of context and registry to separate classes.I just started to extend DefaultCamelContext - is this a good idea or should i extend/implement some other class?Within this class i want to use my own registry (it binds some bean instances) class. I found method setRegistry(org.apache.camel.spi.Registry).

但如何实现这样的注册表?有也有defaultRegistry? (对于测试有一个createRegistry(),有测试之外的东西呢?)

But how to implement such an registry? Is there also a "defaultRegistry"? (for tests there is an createRegistry(), is there something for outside the tests?)

目前我想使用依赖注入(吉斯)粘合全体员工一起结束:注册表将注入豆的情况下,注册表然后在上下文注入和上下文是我的主级注入比创建主 ,设置背景和run()的S吧。

At the end i want to use dependency injection (guice) to glue all stuff together: the registry will inject bean-instances, the registry is then injected in context and context is injected in my main-class than creates "main", sets context and "run()"s it.

推荐答案

骆驼支持

这篇关于如何将Java内设置骆驼背景和注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 22:07