The Spring Framework Addon¶
The spring add-on provides access to Spring libraries from Maven repositories and some supporting functions for best use of Spring in conjunction with Z2. Compared to the Spring add-on of version 2.2 and earlier, the version 2.3 and later has become rather lightweight and can easily be adapted and extended if needed.
All spring binaries are pulled via the Maven component repository fragment com.zfabrik.springframework/mvnFragment (see How_to_Access_a_Maven_Repository on what that is) to the maven component repository environment/mavenDefault that is declared throughout in all examples and that all add-ons add to. Apart from any possible compatibility issues, changing the Spring framework version in use can be done by changing the Maven component repository fragment.
Previously the Spring add-on provided a pre-packaged version of the Spring framework.
Repository¶
Howto¶
Please visit How to Spring.
Samples¶
Please check out sample-spring-basic.
Version map¶
These versions have been pre-configured in the sample's Maven config.
add-on version | Spring version | Spring security version |
---|---|---|
2.1 | 3.1.2 | ... |
2.2 | 3.1.2 | ... |
2.3 | 4.0.2 | 3.2.2 |
2.5 | 4.1.7 | 4.0.1 |
2.5 | 4.1.7 | 4.0.1 |
2.6 | 5.0.6 | 5.0.5 |
2.7 | 5.0.6 | 5.0.5 |
2.8 | 5.2.3 | 5.2.2 |
2.9.1 | 5.3.9 | 5.5.2 |
Details on com.zfabrik.springframework¶
Javadocs can be found here: Javadocs
The Spring add-on defines two component types:
Spring Application Contexts (org.springframework.context)¶
As outlined in How to Spring, it can be useful to expose a Spring application context as a z2 Component, either because you want to expose beans of the context as Z2 components for sharing across modules or because you want to initialize the application context based on worker process target state configuration or other Z2 life cycle functions.
Properties of a Spring Application Context Component:
name | values |
---|---|
com.zfabrik.component.type | org.springframework.context |
context.contextConfigLocation | Defines where to look for the context definition. If prefixed by classpath:, the module's Java component will be searched using a ClassPathXmlApplicationContext (see the Spring Framework documentation).Otherwise the location it will be supplied to FileSystemXmlApplicationContext (see the Spring Framework documentation) and will be search relative to the component's resource folder. |
Spring Beans (org.springframework.bean)¶
The Spring bean component type exposes a Spring bean from a named application context component (see right before) as a Z2 component. See also above.
When asked for a specific implementation via the IResourceHandle
interface (or equivalently via the IComponentsLookup
interface), the component's resource implementation will simply check the bean class for compatibility and either return the bean instance, in case it can be casted, or return null, if it cannot be casted.
name | values |
---|---|
com.zfabrik.component.type | org.springframework.bean |
bean.context | Name of the context component (of type org.springframework.context (see above) that defines the bean. |
bean.name | Name of the bean in the context above |
Updated by Henning Blohm about 2 years ago · 15 revisions