Announcement Announcement Module
Collapse
No announcement yet.
New annotation-based configuration problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • New annotation-based configuration problem

    Hi all,

    I'm facing a problem which now is biting back times and again. I have got a JAR project (fido-core) which contains the 'kernel' of the system and then I have a WAR project (fido-web) which depends on the first one.

    I decided to use an annotation-based approach as regards configuration, so I have got a fido-core.xml file which contains the following:

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:util="http://www.springframework.org/schema/util"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context-2.5.xsd
                            http://www.springframework.org/schema/util 
                            http://www.springframework.org/schema/util/spring-util-2.5.xsd">
    
    <!-- Enables Spring 2.5 annotation-based model   -->
        <context:component-scan base-package="uk.co.jemos.fido" />

    And then a fidoweb-servlet.xml in the WAR project which contains the following:

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:util="http://www.springframework.org/schema/util"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context-2.5.xsd
                            http://www.springframework.org/schema/util 
                            http://www.springframework.org/schema/util/spring-util-2.5.xsd">
    
    	<import resource="classpath:fido-core.xml" />
    Things seem working until the two files declare the same type (please note, not the same singleton, but just the same type). In particular it happens that when it comes to the web application, the only type recognised is the fido-core one and the web one gets lost.

    For instance, I declared a property loader configurer, with different ids, in both the fido-core and fido-web configuration files because I have a set of properties belonging to the core and another one more client-specific. The fido-core executes without problems, but then the WAR application fails becuase it can't find a property which should have been there. The reason is that it's using the fido-core property configurer object and not the web one.

    Using XML-based configuration works fine. Is this a known bug?

    Thanks.

    M.
Working...
X