INT-1041 only falling back to default service interface at initialization time rather than in the default constructor so that getObjectType() returns null instead of inconsistent type information

This commit is contained in:
Mark Fisher
2010-03-18 10:04:44 +00:00
parent 43fa9015c1
commit 4557cc143e
3 changed files with 69 additions and 12 deletions

View File

@@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.PollableChannel;
@@ -290,6 +291,11 @@ public class GatewayProxyFactoryBeanTests {
assertEquals("testBridge", event3.getComponentName());
}
@Test
public void autowiredGateway() {
new ClassPathXmlApplicationContext("gatewayAutowiring.xml", GatewayProxyFactoryBeanTests.class);
}
public static void throwTestException() throws TestException {
throw new TestException();
@@ -312,4 +318,15 @@ public class GatewayProxyFactoryBeanTests {
static class TestException extends Exception {
}
public static class TestClient {
private final TestService service;
@Autowired
public TestClient(TestService service) {
this.service = service;
}
}
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:annotation-config/>
<beans:bean id="testClient" class="org.springframework.integration.gateway.GatewayProxyFactoryBeanTests$TestClient"/>
<channel id="requestChannel"/>
<beans:bean id="proxy" class="org.springframework.integration.gateway.GatewayProxyFactoryBean">
<beans:property name="serviceInterface" value="org.springframework.integration.gateway.TestService"/>
<beans:property name="defaultRequestChannel" ref="requestChannel"/>
</beans:bean>
</beans:beans>