This commit is contained in:
Mark Fisher
2009-02-12 19:51:11 +00:00
parent 04e784d033
commit eaad9e1d81
5 changed files with 108 additions and 8 deletions

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:b="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config />
<channel id="input" />
<channel id="output" />
<b:bean id="service" class="org.springframework.integration.config.xml.ConstructorAutowireTest$TestService" />
<b:bean id="endpoint" class="org.springframework.integration.config.xml.ConstructorAutowireTest$TestEndpoint" />
<inbound-channel-adapter ref="endpoint" method="aProducer" channel="input">
<poller max-messages-per-poll="1">
<interval-trigger interval="300" time-unit="SECONDS" />
</poller>
</inbound-channel-adapter>
<splitter input-channel="input" output-channel="output" ref="endpoint" method="aSplitter" />
<service-activator input-channel="output" ref="endpoint" method="aConsumer"/>
</b:beans>

View File

@@ -0,0 +1,67 @@
/*
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.config.xml;
import java.util.List;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author Jim Moore
* @author Mark Fisher
*/
public class ConstructorAutowireTest {
@Test // INT-568
public void testApplicationContextCreation() {
new ClassPathXmlApplicationContext("ConstructorAutowireTest-context.xml", ConstructorAutowireTest.class);
}
public static class TestService {
public String getVal() {
return "fooble";
}
}
public static class TestEndpoint {
private TestService service;
@Autowired
public TestEndpoint(TestService service) {
this.service = service;
}
public String aProducer() {
return this.service.getVal();
}
public void aConsumer(String str) {
// ignore
}
public List<String> aSplitter(List<String> strs) {
return strs;
}
}
}