Fixed properties resolution issue

This commit is contained in:
David Turanski
2011-07-13 22:11:00 -04:00
parent 7173948f01
commit 4b2fbace61
3 changed files with 13 additions and 25 deletions

View File

@@ -57,14 +57,6 @@ public class ChannelNamePortConfiguration implements PortConfiguration {
for (PortMetadata portMetadata : outputPortMetadataList ) {
results.add(portMetadata.getPortName());
}
/**
* consistent with ClientPortConfiguration impl.
*/
if (results.isEmpty()) {
return null;
}
return results;
}

View File

@@ -10,7 +10,6 @@ import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertiesPropertySource;
@@ -37,9 +36,9 @@ public class Flow implements InitializingBean, BeanNameAware, ChannelResolver, A
private static Log logger = LogFactory.getLog(Flow.class);
private volatile ConfigurableApplicationContext flowContext;
private volatile ClassPathXmlApplicationContext flowContext;
private ConfigurableApplicationContext applicationContext;
private ApplicationContext applicationContext;
private volatile FlowConfiguration flowConfiguration;
@@ -92,22 +91,22 @@ public class Flow implements InitializingBean, BeanNameAware, ChannelResolver, A
Assert.notEmpty(configLocations, "configLocations cannot be empty");
flowContext = new ClassPathXmlApplicationContext(configLocations, applicationContext);
this.flowConfiguration = flowContext.getBean(FlowConfiguration.class);
Assert.notNull(flowConfiguration, "flow context does not contain a flow configuration");
flowContext = new ClassPathXmlApplicationContext(applicationContext);
addReferencedProperties();
this.flowContext.setConfigLocations(configLocations);
this.flowContext.refresh();
this.flowConfiguration = flowContext.getBean(FlowConfiguration.class);
Assert.notNull(flowConfiguration, "flow context does not contain a flow configuration");
validatePortMapping();
this.flowChannelResolver = new BeanFactoryChannelResolver(flowContext);
addReferencedProperties();
bridgeMessagingPorts();
bridgeMessagingPorts();
}
@@ -157,13 +156,10 @@ public class Flow implements InitializingBean, BeanNameAware, ChannelResolver, A
private void addReferencedProperties() {
if (flowProperties != null) {
PropertySource<?> propertySource = new PropertiesPropertySource("flowProperties", flowProperties);
MutablePropertySources propertySources = flowContext.getEnvironment().getPropertySources();
propertySources.addLast(propertySource);
this.flowContext.refresh();
}
}
@@ -195,7 +191,7 @@ public class Flow implements InitializingBean, BeanNameAware, ChannelResolver, A
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = (ConfigurableApplicationContext) applicationContext;
this.applicationContext = applicationContext;
}
}

View File

@@ -12,7 +12,7 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<!-- Need to set ignore-unresolvable true or provide defaults for required properties -->
<context:property-placeholder ignore-unresolvable="true"/>
<context:property-placeholder/>
<int-flow:flow-configuration>
<int-flow:port-mapping>