Este conteúdo não está disponível no idioma selecionado.
1.4. Migrating Spring-DM to Blueprint
Spring-DM is now deprecated
Spring Dynamic Modules (Spring-DM) is now deprecated and will be removed from a future release of JBoss A-MQ. You can continue to use Spring XML and the Spring framework, however, as long as you do not invoke the Spring-DM component.
Prefer Blueprint over Spring-DM
The Blueprint container is now the preferred framework for instantiating, registering, and referencing OSGi services, because this container has now been adopted as an OSGi standard. This ensures greater portability for your OSGi service definitions in the future.
Spring Dynamic Modules (Spring-DM) provided much of the original impetus for the definition of the Blueprint standard, but should now be regarded as obsolescent. Using the Blueprint container does not prevent you from using the Spring framework: the latest version of Spring is compatible with Blueprint.
How to tell whether your code uses Spring-DM
In Spring XML files, the Spring-DM component is associated with the following XML namespace:
http://www.springframework.org/schema/osgi
To identify the parts of your application that use Spring-DM, search for the preceding namespace string in your code.
How to migrate Spring-DM to Blueprint
If you have a Spring XML file that uses the Spring-DM component, migrate this file to Blueprint XML, as follows:
- In the standard Maven project layout, Blueprint XML files are stored under the following directory:
src/main/resources/OSGI-INF/blueprint
If it does not already exist, create this directory under your Maven project. - Move the relevant Spring XML file from the Spring directory,
src/main/resources/META-INF/spring
, to the Blueprint directory,src/main/resources/OSGI-INF/blueprint
. - Edit the Spring XML file in order to convert it to a Blueprint XML file. For example, a typical Spring XML file using Spring-DM has the following outline:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"> ... <osgi:reference id="osgiPlatformTransactionManager" interface="org.springframework.transaction.PlatformTransactionManager"/> <osgi:reference id="osgiJtaTransactionManager" interface="javax.transaction.TransactionManager"/> ... </beans>
You can convert this Spring XML file to a Blueprint XML file by replacing thebeans
root element by a rootblueprint
root element, and replacing Spring-DMosgi:reference
elements by Blueprintreference
elements. For example:<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> ... <reference id="osgiPlatformTransactionManager" interface="org.springframework.transaction.PlatformTransactionManager"/> <reference id="osgiJtaTransactionManager" interface="javax.transaction.TransactionManager"/> ... </blueprint>