Spring alias is not available when working in Grails

I have a problem with Spring aliases in Grails. I have a library .jar file containing classes and Spring that do not work properly. It works as expected when I import them from a standard Java application (without Grails).

The current configuration contains this.

<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
   <property name="contextPath" value="uk.co.company.package"/>
</bean>

<alias name="marshaller" alias="unmarshaller"/>

And error with error.

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'unmarshaller' is defined

Changing the configuration to the following causes it to work properly.

<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
   <property name="contextPath" value="uk.co.company.package"/>
</bean>
<bean id="unmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
   <property name="contextPath" value="uk.co.company.package"/>
</bean>

The configuration is imported and read. For some reason, the alias is not available when I try to use it. What is the reason?

This is with Grails 1.3.7 and Spring 3.0.5.

+3
source share
2 answers

. , Grails resources.xml doWithSpring:

springConfig.addAlias "aliasName", "beanName"

, importBeans

+4

: http://burtbeckwith.com/blog/?p=85

, , , resources.xml. . , , grails 1.3.7.

+1

All Articles