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:
  1. 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.
  2. 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.
  3. 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 the beans root element by a root blueprint root element, and replacing Spring-DM osgi:reference elements by Blueprint reference 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>
Red Hat logoGithubRedditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja oBlog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

© 2024 Red Hat, Inc.