camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-9656) Using SpringBoot HealthEndpoint bean throws AmbiguousMethodCallException
Date Fri, 04 Mar 2016 14:16:40 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-9656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15179924#comment-15179924
] 

Claus Ibsen commented on CAMEL-9656:
------------------------------------

Can you build a sample project or somerthing and attach as a .zip or put on github etc. Then
we can use that to look into this.

> Using SpringBoot HealthEndpoint bean throws AmbiguousMethodCallException
> ------------------------------------------------------------------------
>
>                 Key: CAMEL-9656
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9656
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring-boot
>    Affects Versions: 2.16.2
>            Reporter: Colin Harms
>            Priority: Minor
>
> I'm trying to re-use the Springboot Actuator HealthEndpoint and InfoEndpoint beans and
exposing them via rest:
> {code}
> @Autowired
> HealthEndpoint healthEndpoint;
> ...
> //build the route
> from("rest:get:health").routeId("REST-healthcheck").bean(healthEndpoint, "invoke");
> {code}
> However when that gets invoked, it throws a AmbiguousMethodCallException and its other
candidate for "invoke()" is on the abstract class that HealthEndpoint is extending
> It looks like the issue is here:
> https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java#L1020
> In this case HealthEndpoint extends AbstractHealthEndpoint, which is abstract, but invoke()
is declared on the Endpoint interface. So this logic: 
> {code} !isFromInterface && Modifier.isAbstract(info.getMethod().getModifiers())
{code}
> Will not evaluate to true, and the abstract method will remain a candidate.
> Here are the sources for the Endpoint/HealthEndpoint/AbstractEndpoint classes:
> https://github.com/spring-projects/spring-boot/blob/master/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Endpoint.java#L56
> https://github.com/spring-projects/spring-boot/blob/master/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java#L32
> https://github.com/spring-projects/spring-boot/blob/master/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java#L36
> It seems this is intentional, due to the "if the class is an interface then keep the
method" comment in BeanInfo.
> I'm curious as to why that is.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message