java - Spring Integration: gateway bean not found -
i try using spring integration in different jars. in a.jar si-context.xml:
<context:annotation-config /> <int:annotation-config /> <int:channel id="upperservicechannel"> <int:priority-queue /> </int:channel> <int:gateway id="uppergateway" default-request-timeout="5000" default-reply-timeout="5000" default-request-channel="upperservicechannel" service-interface="com.company.proj.gw.iupperstringconversation"> <int:method name="touppercase" /> </int:gateway> <bean id="touppercaseservice" class="com.company.proj.service.touppercaseservice" /> <int:service-activator id="serviceactivatortouppercase" input-channel="upperservicechannel" method="touppercase" ref="touppercaseservice" /> <int:poller id="poller" default="true" fixed-delay="1000" /> <context:component-scan base-package="com.company"/> in bean i'm using gateway:
@component(value = "upper") public class upperadapter extends aadapter<message<string>> { @autowired iupperstringconversation gw; it's working. problem is, if try using upperadapter other project (b.jar). b-context.xml:
<import resource="classpath*:/*si-context.xml" /> <context:annotation-config /> <int:annotation-config /> @component(value="router") public class router { @autowired private map<string, aadapter<?>> adapters; and here get:
caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'upper': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: com.company.proj.gw.iupperstringconversation com.company.proj.adapter.upperadapter.gw; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no matching bean of type [com.company.proj.gw.iupperstringconversation] found dependency: expected @ least 1 bean qualifies autowire candidate dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)} after set spring log level debug, information:
debug o.s.c.a.classpathbeandefinitionscanner - ignored because not concrete top-level class: url [jar:file:/home/tomto/documents/workspace-sts/integration-fw/src/main/resources/meta-inf/lib/integration-fw-module-string-0.0.1-snapshot.jar!/com/company/proj/gw/iupperstringconversation.class] of course, it's true, becouse (maybe i'm wrong ;)) @ runtime generated gateway spring.
the iupperstringconversation:
public interface iupperstringconversation { public string touppercase(string text); } what missed?
thx!
we had similar issue, our gateways not getting injected our service object:
project structure: ---------------- -parent/ -common/ --gateways defined here -module-a/ -module-b/ the exception message received in module-b was:
org.springframework.beans.factory.beancreationexception: ... injection of autowired dependencies failed ... illegalargumentexception: class must not null apparently issue being caused conflicting dependencies had on module-b classpath. after cleaned spring dependencies in pom.xml worked!
Comments
Post a Comment