Standard bean definition resource

Introduced in MDA 0.10.0, the standard bean definition resource is provided to simplify writing MDA configurations using Spring Framework’s XML configuration scheme.

It is expected, and recommended, that most MDA applications using XML configuration will make use of this resource. It can be incorporated into your configuration as follows:

<import resource="classpath:net/shibboleth/metadata/beans.xml"/>

The standard bean definition resource provides parent bean definitions and assistance with migration from older versions of the MDA.

Parent bean definitions

For each component provided by the MDA framework, the resource includes a parent bean to simplify declarations in your configuration.

One abstract bean is defined for each available bean class, named after the class's simple name prefixed by "mda.". The definition will also include the init-method and destroy-method properties for the bean when appropriate.

For example:

<bean ... parent="mda.XMLSignatureValidationStage"> ... </bean>

Migration assistance

The following beans are defined to assist with migration from previous versions of the MDA framework:

  • mda.RelocatedBeanFactoryPostProcessor is an abstract bean providing access to the Shibboleth support class implementing the migration assistance functionality.

  • mda.MigrationClassMapis a <util:map> from old class names to new class names.

  • mda.MigrationBeanMapis a <util:map> from old bean names to new bean names.

  • mda.MigrationAssistanceBean is instantiated in every configuration and references the maps above; if it encounters one of the “old” names it logs a warning message and (where appropriate) changes your configuration on-the-fly to refer to the replacement name.

For example:

WARN - Java class 'net.shibboleth.utilities.java.support.xml.SimpleNamespaceContext', (Bean ID: commonNamespaces): This will be removed in the next major version of this software; replacement is net.shibboleth.metadata.dom.SimpleNamespaceContext

Acting on these warnings is strongly recommended.

If you need to disable this functionality, you can define a mda.MigrationAssistanceBeanof your own after the <include> of the resource; this can be of any type as its only purpose is to override the standard definition.

You can override mda.MigrationClassMap and mda.MigrationBeanMap in the same way, or define another instance of mda.RelocatedBeanFactoryPostProcessor if you need similar assistance in migrating classes and beans of your own.

Migration assistance and Spring contexts

The mda.MigrationAssistanceBean will only be instantiated in the Spring context in which the standard bean definition resource is imported. This instance of the bean will be able to process other beans instantiated within that context. It will not process uninstantiated bean definitions (e.g., lazy-initialised beans which are not used, abstract beans).

If your application uses child contexts, note that in general bean definitions are inherited from parent contexts, but those bean definitions are not instantiated. This means that the MigrationAssistanceBean from the parent context will not be able to process beans instantiated in the child context.

If you need migration assistance in a child context, instantiate the bean again in the child context like this: