You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gardella juan <ga...@gmail.com> on 2013/04/03 15:53:48 UTC

Enable to use default scope beans

Hi,

For example I have a bean:

@Component("myBean")
public class MyBean{
 
 public void foo(){
 }
 
}

And the route:

from("...").to("bean:myBean")

And works, but if I change the visibilty of MyBean to package fails:

@Component("myBean")
class MyBean{
 
 public void foo(){
 }
 
}

The route fails. I 've create the jira
https://issues.apache.org/jira/browse/CAMEL-6206, but was closed because it
was not very clear.

Thanks,
Juan






--
View this message in context: http://camel.465427.n5.nabble.com/Enable-to-use-default-scope-beans-tp5730283.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Enable to use default scope beans

Posted by Gardella juan <ga...@gmail.com>.
Thanks for answer Claus!

Yes I know why Camel cannot introspect the bean, but for example Spring
Framework can introspect the bean with the package visibilty scope. Use
beans with package visibilty improves encapsulation, so I created a jira
ticket as an improvement to enable Camel introspect bean with package
visibilty.

Regards,
Juan


2013/4/10 Claus Ibsen-2 [via Camel] <
ml-node+s465427n5730654h20@n5.nabble.com>

> Hi
>
> The problem is that you use "default" scope for your bean.
> And then Camel cannot introspect the bean to figure out which method
> it has, and find the "foo" method to call.
>
> You can possible google about "default" package visibility in Java, etc
> such as:
>
> http://stackoverflow.com/questions/714791/what-is-the-default-scope-of-a-method-in-java
>
>
>
>
>
> On Wed, Apr 3, 2013 at 3:53 PM, Gardella juan
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=5730654&i=0>>
> wrote:
>
> > Hi,
> >
> > For example I have a bean:
> >
> > @Component("myBean")
> > public class MyBean{
> >
> >  public void foo(){
> >  }
> >
> > }
> >
> > And the route:
> >
> > from("...").to("bean:myBean")
> >
> > And works, but if I change the visibilty of MyBean to package fails:
> >
> > @Component("myBean")
> > class MyBean{
> >
> >  public void foo(){
> >  }
> >
> > }
> >
> > The route fails. I 've create the jira
> > https://issues.apache.org/jira/browse/CAMEL-6206, but was closed
> because it
> > was not very clear.
> >
> > Thanks,
> > Juan
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Enable-to-use-default-scope-beans-tp5730283.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5730654&i=1>
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Enable-to-use-default-scope-beans-tp5730283p5730654.html
>  To unsubscribe from Enable to use default scope beans, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5730283&code=Z2FyZGVsbGFqdWFucGFibG9AZ21haWwuY29tfDU3MzAyODN8LTE1MjMxMTI5MDU=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Enable-to-use-default-scope-beans-tp5730283p5730657.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Enable to use default scope beans

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The problem is that you use "default" scope for your bean.
And then Camel cannot introspect the bean to figure out which method
it has, and find the "foo" method to call.

You can possible google about "default" package visibility in Java, etc such as:
http://stackoverflow.com/questions/714791/what-is-the-default-scope-of-a-method-in-java





On Wed, Apr 3, 2013 at 3:53 PM, Gardella juan
<ga...@gmail.com> wrote:
> Hi,
>
> For example I have a bean:
>
> @Component("myBean")
> public class MyBean{
>
>  public void foo(){
>  }
>
> }
>
> And the route:
>
> from("...").to("bean:myBean")
>
> And works, but if I change the visibilty of MyBean to package fails:
>
> @Component("myBean")
> class MyBean{
>
>  public void foo(){
>  }
>
> }
>
> The route fails. I 've create the jira
> https://issues.apache.org/jira/browse/CAMEL-6206, but was closed because it
> was not very clear.
>
> Thanks,
> Juan
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Enable-to-use-default-scope-beans-tp5730283.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen