It took a while to release it (due to other work that needed to be completed first), and it took me a couple of weeks to announce it (i.e. until now), but my bit of news for today is this: the first release of our CDI Spring bridge, aka Seam Spring 3.1.0.Alpha1 is out.
This first release provides:
- facilities to bootstrap Spring contexts or access outstanding Spring contexts (e.g. web contexts bootstrapped by the ContextLoaderListener)
- facilities to import Spring beans as CDI beans (thus making them available for standard CDI injection)
- facilities to import CDI beans an Spring beans (thus making them available for Spring injection), including dedicated namespace support
As this is an Alpha, I am looking forward for feedback, new feature suggestions (even suggestions on prioritizing certain items that we have on the roadmap). Please use it extensively, and file bug reports(they're inevitable, and the sooner, the better).
Usage examples can be found for now in the Arquillian tests of the project source code, and I will follow up with a post describing a detailed example pretty soon.
Here are a few quick tips when migrating Hibernate 3-based applications to JBoss AS7, covering the options available for JBoss AS 7.0.0.Final.
In previous versions of JBoss AS, a version of Hibernate was always present on the classpath. As a result, applications that used Hibernate directly have traditionally avoided to include it in the deployment in order to avoid classloading conflicts, or have taken additional steps to enforce classloader isolation.
The visibility rules have changed in AS7 due to the new modular classloading model, and so Hibernate libraries are made visible by default only to JPA deployments. The changes may affect existing Hibernate applications, so this is a short breakdown on the available options when running on JBoss AS7. Wherever this is subject to change in future versions, we also provide a succint description of the forthcoming enhancements.
As of the 7.0.0.Final version of JBoss AS, native (i.e. non-JPA) Hibernate applications can opt between:
- packaging a Hibernate version of their choice inside the application;
- adding the 'org.hibernate' module as a dependency to the application (adds Hibernate 4), e.g. by adding to the deployment a META-INF/MANIFEST.MF file that contains the following line:
- creating a custom Hibernate 3 module, and adding it as a dependency to the application,e.g.
Dependencies: my-custom-hibernate-module- noting that future versions of JBoss AS7 may already provide a skeleton Hibernate 3 module.
JPA applications that create an EntityManagerFactory on their own, either using the PersistenceProvider SPI directly or through an intermediary mechanism such as Spring's LocalContainerEntityManagerFactoryBean have the same options as native Hibernate applications, noting that the 'org.hibernate' module may be added by default as a dependency as described here - so you may need to exclude it explicitly if you want to provide a version of your own. Therefore, under typical circumstances such applications can:
- use the default setup (and use Hibernate 4)
- package a Hibernate version of their choice and exclude the default 'org.hibernate' module by adding a WEB-INF/jboss-deployment-structure.xml or META-INF/jboss-deployment-structure.xml file (depending whether the deployment is a WAR or not) as follows:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0"> <deployment> <exclusions> <module name="org.hibernate"/> </exclusions> <deployment> </jboss-deployment-structure>
- create a custom module and using it instead of the default 'org.hibernate';
Generally speaking, standard Java EE-applications may ignore the provider implementation and rely on the standard features provided by the container - JBoss AS7 supporting standard JPA 1.0 and 2.0.
However, in future versions of JBoss AS7 it will be possible to use alternative persistence provider implementations - for more details please follow AS7-566.
I'm happy to invite you to attend the
Spring into JBoss webinar on June 2nd. Everyone using Spring and running their applications on JBoss (or planning to do so) must attend.
You can find more details about the webinar here.
Oh, and in case you really cannot make it - no worries, the webinar is recorded and you'll be able to watch it whenever you have time.