-
1. Re: Generics support for bean references
rcernich Aug 24, 2012 10:46 AM (in response to jpechanec)Hey Jiri,
It should be easy enough to test out to see. Keep in mind that references are injected based on the raw type if a name is not specified, so you should use the following form when you test:
@Service(value=EsbService.class, name="ServiceA") public class ServiceA implements EsbService<String, MyClass> { public String process(MyClass msg) { // do something } } @Reference("ServiceA") EsbService<String, MyClass> serviceA; @Reference("ServiceA2") EsbService<String, String> serviceA2; @Reference("ServiceB") EsbService<ClassA, ClassB> serviceB;
When I get some time, I'll try to test it out myself.
Best,
Rob
-
2. Re: Generics support for bean references
jpechanec Aug 27, 2012 3:38 AM (in response to rcernich)Hi Rob,
sorry for not explaining it properly. I meant a little bit different scenario.
Let's suppose we have 2 camel services, each with interface.esb interface. If I would want to call those services from Java code using @Reference then I'd need to provide two Java interfaces that would conform to input/output message formats. My idea was to provide generalized interface that could be used for access to any such service - technically we can speak about access to BPM and other service implementations as well.
-
3. Re: Generics support for bean references
rcernich Aug 27, 2012 9:48 AM (in response to jpechanec)Hey Jiri,
You do not need to declare distinct interfaces for each service. The services themselves are named. The default name for a service declared using @Service or injected using @Reference is the simple name of the class, but you can specify a name for the service, as in the code snippet above. This is known to work.
The only question is whether or not a service can be declared using generics (which I suspect is OK, but haven't actually tested).
Best,
Rob