title: Camel how to add something to registry - with java, in general
body: <p>sometimes I have to add an object to camel registry (of course with java). In most cases it is a dataSource .</p>
  
  <p>My problem is I can't figure out a general working way.</p>
  
  <p>I always begin to acquire the registry:</p>
  
  <pre><code>getContext().getRegistry();
  </code></pre>
  
  <p>But "Registry" does not have any method to add an object. So I have to try (with debugger) what kind of registry is in use</p>
  
  <pre><code>getContext().getRegistry(some.class)&lt;some method to add something&gt;;
  </code></pre>
  
  <p>For example in one project (camel blueprint) I have to call</p>
  
  <pre><code>SimpleRegistry registry = new SimpleRegistry();
  registry.put("some", bean);
  getContext().getRegistry(CompositeRegistry.class).addRegistry(registry);
  </code></pre>
  
  <p>Now I created a project with same structure (also same maven parent) but now the code from above stops working because for some reason now camel uses a <code>PropertyPlaceholderDelegateRegistry</code> I am sure there will be code to add my bean but;</p>
  
  <p>Is there code that works with every setup to add something to camels registry?</p>