You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "dr.jeff" <jl...@systechnologies.com> on 2007/04/28 20:48:13 UTC

[camel] spring container

Is this logic in org.apache.camel.spring.RouteBuilderFinder correct?

    /**
     * Lets ignore beans that are not explicitly configured in the
spring.xml
     */
    protected boolean shouldIgnoreBean(Class type) {
        Map beans = applicationContext.getBeansOfType(type, true, true);
        if (beans == null || beans.isEmpty()) {
            return false;
        }
        // TODO apply some filter?
        return true;
    }

If the application context finds beans of the requested type (which it does
if they are defined in the xml configuration) then the method returns true,
meaning "yes, should ignore". 
But isn't that just the opposite of what is desired? Or am I missing the
whole point here?
-- 
View this message in context: http://www.nabble.com/-camel--spring-container-tf3663132s2354.html#a10235603
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: [camel] spring container

Posted by James Strachan <ja...@gmail.com>.
On 4/28/07, dr.jeff <jl...@systechnologies.com> wrote:
>
> Is this logic in org.apache.camel.spring.RouteBuilderFinder correct?
>
>     /**
>      * Lets ignore beans that are not explicitly configured in the
> spring.xml
>      */
>     protected boolean shouldIgnoreBean(Class type) {
>         Map beans = applicationContext.getBeansOfType(type, true, true);
>         if (beans == null || beans.isEmpty()) {
>             return false;
>         }
>         // TODO apply some filter?
>         return true;
>     }
>
> If the application context finds beans of the requested type (which it does
> if they are defined in the xml configuration) then the method returns true,
> meaning "yes, should ignore".
> But isn't that just the opposite of what is desired? Or am I missing the
> whole point here?

So the idea is to avoid having to declare in the spring.xml every
single RouteBuilder you write. Instead you can just get the
RouteBuilderFinder to just find all of the RouteBuilder classes you
have and auto-wire them up.

However if you explicitly configure a RouteBuilder in your spring.xml
(e.g. to dependency inject it with something), then its not included
in the auto-wiring.

The intent is to just avoid developers having to write reams of XML
unless they really want to.

-- 
James
-------
http://macstrac.blogspot.com/