Я пытаюсь использовать интеграцию с весной в разных банках. В a.jar си-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"/>
В бобе я использую этот шлюз:
@Component(value = "upper")
public class UpperAdapter extends AAdapter<Message<String>> {
@Autowired
IUpperStringConversation gw;
Это работает. Проблема в том, что если я попытаюсь использовать мой UpperAdapter из другого проекта (B.jar). б-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;
И вот я получаю:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'upper': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.company.proj.gw.IUpperStringConversation com.company.proj.adapter.UpperAdapter.gw; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.company.proj.gw.IUpperStringConversation] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
После того как я установить уровень журнала пружинный для отладки, получить эту информацию:
DEBUG o.s.c.a.ClassPathBeanDefinitionScanner - Ignored because not a 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]
Конечно, это правда, потому что (может быть, я ошибаюсь;)), к весне он будет запущен через шлюз.
IUpperStringConversation:
public interface IUpperStringConversation {
public String toUpperCase(String text);
}
Что я пропустил?
Thx!
Включите ведение журнала DEBUG для 'org.springframework'; вы получите обширные журналы отладки для разбора xml, поиска/создания боба и т. д. –
Вы когда-нибудь решали эту проблему? – EoD