Java Chatter and Random Nagging

Sunday, January 20, 2008

Migrating to Spring 2.5

Just finished the migration from my pet project (which was Spring 2.0.6) to Spring 2.5.1
I must say, contrary to the claim on the SpringSource website, my migration did not went as smoothly as expected. I had more problems now then when migrating from Spring 1.0.2 to Spring 2 (of course my pet project wasn't that big back then).
Encountered problems and their fixes:
  1. Declarative transactions are not working (symptom "org.hibernate.HibernateException: createQuery is not valid without active transaction"). The fix is to remove the property <property name="current_session_context_class">thread</property>. Luckily I found this solution rather quickly.
  2. Problems with auto-wiring of Configurable beans. My solution was to switch from autowiring by type to by name. I filed an issue for this problem.
  3. <aop:spring-configured/> must be replaced by <context:spring-configured/> (symptom: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:spring-configured')
    The declaration is as follows:

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">



That's it. If you want to excuse me now, I have to experiment with <context:component-scan>

2 Comments:

At 9:14 pm, Anonymous Anonymous said...

You can keep using <aop:spring-configured/> if you declare the 2.0 version of the AOP namespace (spring-aop-2.0.xsd). Once you change to the 2.5 version, you need to use <context:spring-configured/>. However, existing code can keep declaring spring-aop-2.0, even mixing and matching with 2.5 namespaces...

 
At 6:47 pm, Anonymous Anonymous said...

Thanks a lot for compiling this, it was very helpful!

Does anyone else think that combining namespace version will eventually lead to conflicts? Juergen would know, but it still makes me nervous. I went ahead and did the 2.5 migration.

 

Post a Comment

<< Home