You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by js...@apache.org on 2007/08/14 20:55:57 UTC
svn commit: r565855 - in
/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring:
SpringCamelContext.java spi/SpringInjector.java
Author: jstrachan
Date: Tue Aug 14 11:55:57 2007
New Revision: 565855
URL: http://svn.apache.org/viewvc?view=rev&rev=565855
Log:
attempted fix for CAMEL-103, though we still need a test case to prove it
Modified:
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java
Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java?view=diff&rev=565855&r1=565854&r2=565855
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java Tue Aug 14 11:55:57 2007
@@ -153,7 +153,13 @@
@Override
protected Injector createInjector() {
- return new SpringInjector((AbstractRefreshableApplicationContext)getApplicationContext());
+ if (applicationContext instanceof ConfigurableApplicationContext) {
+ return new SpringInjector((ConfigurableApplicationContext)applicationContext);
+ }
+ else {
+ LOG.warn("Cannot use SpringInjector as applicationContext is not a ConfigurableApplicationContext as its: " + applicationContext);
+ return super.createInjector();
+ }
}
@Override
Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java?view=diff&rev=565855&r1=565854&r2=565855
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringInjector.java Tue Aug 14 11:55:57 2007
@@ -22,6 +22,7 @@
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.support.AbstractRefreshableApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
/**
* A Spring implementation of {@link Injector} allowing Spring to be used to dependency inject newly created POJOs
@@ -29,12 +30,11 @@
* @version $Revision$
*/
public class SpringInjector implements Injector {
- private static final transient Log LOG = LogFactory.getLog(SpringInjector.class);
- private final AbstractRefreshableApplicationContext applicationContext;
+ private final ConfigurableApplicationContext applicationContext;
private int autowireMode = AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR;
private boolean dependencyCheck;
- public SpringInjector(AbstractRefreshableApplicationContext applicationContext) {
+ public SpringInjector(ConfigurableApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}