Showing posts with label spring. Show all posts
Showing posts with label spring. Show all posts

Friday, October 11, 2013

Migrating ehcache to spring 3.2.3

Spring 3.2.3 offered new cache annotations and xml constructions. Make sure you use
org.springframework.cache.annotation.Cacheable instead of com.googlecode.ehcache.annotations.Cacheable. The correct xml initialization:


    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
        <property name="cacheManager" ref="ehcache"/>
    </bean>

    <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
        <property name="configLocation" value="classpath:ehcache.xml"/>
        <property name="shared" value="true"/>
    </bean>

    <cache:annotation-driven cache-manager="cacheManager" />

This must be placed in contextLoader part of spring congiguration (specified by contextConfigLocation parameter in web.xml), not in webapp part! cache namespace:
xmlns:cache="http://www.springframework.org/schema/cache", location: http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd

Also add dependency on 'net.sf.ehcache:ehcache:2.7.4' instead of 'com.googlecode.ehcache-spring-annotations:ehcache-spring-annotations:1.2.0', 'cause we will use spring's annotation.


Wednesday, June 12, 2013

While using dev mode of GWT in Jetbrains IDEA, which runs jetty, I need to use spring instrumentation.
Default parameter -javaagent:spring-instrumentation.jar didn't work for me.
To run it wit Jetty you are to add additional parameter -Xbootclasspath. The final string:
-javaagent:/spring-instrument-3.2.0.RELEASE.jar -Xbootclasspath/a:spring-instrument-3.2.0.RELEASE.jar


Thanks to this:
http://gradle.1045684.n5.nabble.com/Java-Agent-LTW-problem-with-Gradle-and-Jetty-td4938600.html

Thursday, April 11, 2013

jaxws @Webservice and @Transactional

The magic is:
<tx:annotation-driven mode="aspectj"/>