Project

General

Profile

Spring Add-on » History » Version 11

Henning Blohm, 11.06.2018 14:59

1 1 Henning Blohm
h1. The Spring Framework Addon
2
3 11 Henning Blohm
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.
4 1 Henning Blohm
5 10 Henning Blohm
All spring binaries are pulled via the Maven component repository fragment "com.zfabrik.springframework/mvnFragment":https://redmine.z2-environment.net/projects/z2-addons/repository/revisions/master/entry/com.zfabrik.springframework/mvnFragment.properties (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.
6 9 Henning Blohm
7
Previously the Spring add-on provided a pre-packaged version of the Spring framework.
8
9 6 Henning Blohm
h2. Repository
10
11
"z2-addons-spring":http://redmine.z2-environment.net/projects/z2-addons/repository/z2-addons-spring
12
13 4 Henning Blohm
h2. Howto
14 1 Henning Blohm
15 4 Henning Blohm
Please visit [[How to Spring]].
16
17
h2. Samples
18
19 1 Henning Blohm
Please check out [[sample-spring-basic]].
20 7 Henning Blohm
21
h2. Version map
22
23
|_. add-on version |_. Spring version |
24 1 Henning Blohm
| 2.1 | 3.1.2 |
25 9 Henning Blohm
| 2.2 | 3.1.2 |
26
| 2.3 | 4.0.2 |
27 7 Henning Blohm
28 1 Henning Blohm
29 8 Henning Blohm
h2. Details on com.zfabrik.springframework
30
31
Javadocs can be found here: "Javadocs":http://www.z2-environment.net/javadoc/com.zfabrik.springframework!2Fjava/api/index.html
32 4 Henning Blohm
33
The Spring add-on defines two component types:
34
35
h3. Spring Application Contexts (*org.springframework.context*)
36
37 5 Henning Blohm
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.
38 4 Henning Blohm
39
Properties of a Spring Application Context Component:
40
41
|_. name |_. values |
42
|com.zfabrik.component.type |org.springframework.context|
43
|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.|
44
45
46
h3. Spring Beans (*org.springframework.bean*)
47
48
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.
49
When asked for a specific implementation via the <code>IResourceHandle</code> interface (or equivalently via the <code>IComponentsLookup</code> 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.
50
51
Properties of a Spring Bean Component:
52
|_. name |_. values |
53
|com.zfabrik.component.type|org.springframework.bean|
54
|bean.context|Name of the context component (of type org.springframework.context (see above) that defines the bean.|
55
|bean.name|Name of the bean in the context above|