Leszek Gawron wrote:
Felix Knecht wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Giacomo Pati schrieb:
Leszek Gawron wrote:
with cocoon modes enabled for spring you can do something like
this:
I always get the error:
Embedded error: Cannot invoke listener
[EMAIL PROTECTED]
No bean named 'myDao' is defined
Putting the 'myDao' bean definition into the myContext.xml it works.
Maybe I need to enable cocoon modes for spring, but
where do I enable cocoon modes for spring?
Let me test that...
This is another question to Carsten (SettingsElementParser):
public BeanDefinition parse(Element element, ParserContext parserContext) {
final String springConfigLocation = this.getAttributeValue(element,
"location",
Constants.DEFAULT_SPRING_CONFIGURATION_LOCATION);
// create bean definition for settings object
final String componentClassName = this.getAttributeValue(element,
PROCESSOR_CLASS_NAME_ATTR,
SettingsBeanFactoryPostProcessor.class.getName());
final RootBeanDefinition beanDef = this.createBeanDefinition(componentClassName,
"init", false);
// if running mode is specified add it as a property
final String runningMode = this.getAttributeValue(element,
RUNNING_MODE_ATTR, null);
if (runningMode != null) {
beanDef.getPropertyValues().addPropertyValue("runningMode",
runningMode);
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This code does not take into consideration the fact that cocoon running
mode may be passed using system property
// register settings bean
this.register(beanDef, Settings.ROLE, parserContext.getRegistry());
// register a PropertyPlaceholderConfigurer
this.registerPropertyOverrideConfigurer(parserContext,
springConfigLocation);
// add the servlet context as a bean
this.addComponent(ServletContextFactoryBean.class.getName(),
ServletContext.class.getName(), null, false,
parserContext.getRegistry());
// handle includes
try {
this.handleBeanInclude(parserContext, null,
Constants.DEFAULT_SPRING_CONFIGURATION_LOCATION, "*.xml", true);
this.handleBeanInclude(parserContext, null, Constants.DEFAULT_SPRING_CONFIGURATION_LOCATION
+ "/" + runningMode, "*.xml", true);
when running mode is set with system property the runningMode variable
is null here.
} catch (Exception e) {
throw new BeanDefinitionStoreException("Unable to read spring configurations
from " + Constants.DEFAULT_SPRING_CONFIGURATION_LOCATION, e);
}
return null;
}
--
Leszek Gawron CTO at MobileBox Ltd.