INT-3011 Groovy Classloader and BeanFactory Fixes
See: https://jira.springsource.org/browse/INT-3011 INT-3011 Pass BeanClassLoader and BeanFactory to GroovyScriptFactory INT-3011 Move 'implements BeanFactoryAware, BeanClassLoaderAware' to AbstractScriptExecutingMessageProcessor and GroovyControlBusFactory
This commit is contained in:
committed by
Gary Russell
parent
22dc63ad5a
commit
92d59f7116
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2013 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
|
||||
@@ -15,6 +15,10 @@ package org.springframework.integration.scripting;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageHandlingException;
|
||||
import org.springframework.integration.handler.MessageProcessor;
|
||||
@@ -25,12 +29,16 @@ import org.springframework.util.Assert;
|
||||
* Base {@link MessageProcessor} for scripting implementations to extend.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Stefan Reuter
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class AbstractScriptExecutingMessageProcessor<T> implements MessageProcessor<T> {
|
||||
public abstract class AbstractScriptExecutingMessageProcessor<T> implements MessageProcessor<T>, BeanClassLoaderAware, BeanFactoryAware {
|
||||
|
||||
private final ScriptVariableGenerator scriptVariableGenerator;
|
||||
|
||||
private volatile ClassLoader beanClassLoader;
|
||||
|
||||
private volatile BeanFactory beanFactory;
|
||||
|
||||
protected AbstractScriptExecutingMessageProcessor() {
|
||||
this.scriptVariableGenerator = new DefaultScriptVariableGenerator();
|
||||
@@ -56,6 +64,23 @@ public abstract class AbstractScriptExecutingMessageProcessor<T> implements Mess
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
protected ClassLoader getBeanClassLoader() {
|
||||
return this.beanClassLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
protected BeanFactory getBeanFactory() {
|
||||
return this.beanFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses must implement this method to create a script source,
|
||||
|
||||
Reference in New Issue
Block a user