You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Martin Gilday (JIRA)" <ji...@apache.org> on 2009/05/31 12:53:50 UTC

[jira] Created: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
--------------------------------------------------------------------------------------

                 Key: CAMEL-1663
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-spring
    Affects Versions: 2.0-M1, 1.6.0
            Reporter: Martin Gilday


Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Martin Gilday (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Gilday updated CAMEL-1663:
---------------------------------

    Attachment: camel-1663.zip

Test case is written for 1.6.0 which is the version I am using.  I have run the tests against 2.0-M1 and get the same result.  I have left the code in the POM and tests so the two can be toggled.

> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.6.0, 2.0-M1
>            Reporter: Martin Gilday
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52078#action_52078 ] 

Claus Ibsen commented on CAMEL-1663:
------------------------------------

And this unit test in camel-spring demonstrating the mixed usage of annotations in same POJO with Spring and Camel annotations

trunk: 781974.


> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.5.0, 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>             Fix For: 2.0-M2
>
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52079#action_52079 ] 

Claus Ibsen commented on CAMEL-1663:
------------------------------------

Camel 1.x *before* fix
{code}
[                          main] ClassPathXmlApplicationContext INFO  Bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[                          main] ClassPathXmlApplicationContext INFO  Bean 'org.springframework.transaction.config.internalTransactionAdvisor' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[                          main] DefaultCamelContext            INFO  JMX enabled. Using InstrumentationLifecycleStrategy.
[                          main] ClassPathXmlApplicationContext INFO  Bean 'annotatedRoute' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[                          main] DriverManagerDataSource        INFO  Loaded JDBC driver: org.hsqldb.jdbcDriver
[                          main] ClassPathXmlApplicationContext INFO  Bean 'dataSource' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[                          main] ClassPathXmlApplicationContext INFO  Bean 'txManager' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[                          main] ClassPathXmlApplicationContext INFO  Bean 'PROPAGATION_REQUIRED' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[                          main] ClassPathXmlApplicationContext INFO  Bean 'camel' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[                          main] ClassPathXmlApplicationContext INFO  Bean 'camel' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
{code}

Camel 2.0 *after* fix:
{code}
2009-06-05 12:36:31,711 [main           ] INFO  ClassPathXmlApplicationContext - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@5c98f3]: org.springframework.beans.factory.support.DefaultListableBeanFactory@75db37
2009-06-05 12:36:31,802 [main           ] INFO  ClassPathXmlApplicationContext - Bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2009-06-05 12:36:31,809 [main           ] INFO  ClassPathXmlApplicationContext - Bean 'org.springframework.transaction.config.internalTransactionAdvisor' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
{code}

Notice that with the fix all the beans used by the application as such can be post processed.
In Camel 1.x many of the beans *cannot* be.

> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.5.0, 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>             Fix For: 2.0-M2
>
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52018#action_52018 ] 

Claus Ibsen commented on CAMEL-1663:
------------------------------------

This is a hard one to get fixed.

Namespace handlers in Spring is like a 2nd class citizen so the CamelBeanPostProcessor is not registered like the regular post processors as its done from a namespace handler. And then Spring just goes blank and denies running post processors as the initial number of post processors != current number of post processors.

Then you get the dreadful 'bean X is not eligible for post processing'.

Its kinda like a catch-22 situation. I got a few more ideas to find a solution.

> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.6.0, 2.0-M1
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52025#action_52025 ] 

Claus Ibsen commented on CAMEL-1663:
------------------------------------

Okay finally looks like I am on track now.

Spring is really a bit odd, as it disable post processing if you use its application context to lookup certain beans.
That ended up in a circular reference as CamelContext automatic creates a CamelBeanPostProcessor, and the CamelBeanPostProcessor have a reference to the CamelContext it belongs to. And as this id done while Spring namespace handler creates the CamelContext it regard it as a circular reference. And then the ballpark for post processors changes. And that looks like the case for the Autowired and other post processors for the @annotation stuff do not kick in.

To remedy this problem I use a reference to the CamelContext bean id from the CamelBeanPostProcessor (just a String) then we do not have a circular reference.

As I got a bit of experiment code I need to work a bit more on it to get a polished and working solution.
With the current code however I got both Spring and Camel to be happy and have their post processors work side by side and being able to setup all the @annotations people insert on their POJO classes and the Camel RouteBuilders as well.




> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.6.0, 2.0-M1
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-1663:
-------------------------------

    Affects Version/s: 1.5.0
                       1.6.1
        Fix Version/s: 2.0-M2

> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.5.0, 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>             Fix For: 2.0-M2
>
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52030#action_52030 ] 

Claus Ibsen commented on CAMEL-1663:
------------------------------------

trunk: 781314

The {{spring-event}} component has a flaw. I will look into it but if its to complex to get working I would consider ditching it.
Much more important to get the @annotations to work.

Martin I have applied it on trunk only. If you have the time please try testing it in your system.

> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.5.0, 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>             Fix For: 2.0-M2
>
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-1663.
--------------------------------

    Resolution: Fixed

And the last part with the spring-event fix

trunk: 781349.

> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.5.0, 1.6.0, 2.0-M1, 1.6.1
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>             Fix For: 2.0-M2
>
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-1663) Spring BeanPostProcessors do not work on beans which are used in Camel route builders

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-1663:
----------------------------------

    Assignee: Claus Ibsen

> Spring BeanPostProcessors do not work on beans which are used in Camel route builders 
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1663
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 1.6.0, 2.0-M1
>            Reporter: Martin Gilday
>            Assignee: Claus Ibsen
>         Attachments: camel-1663.zip
>
>
> Spring PostProcessors stop working for beans which are injected into Camel route builders.  See attached test cases showing processor breaks as soon as injected into a route builder.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.