The osgi
namespace allows offers two
global attributes for specifying default behaviours for all
importers declared in that file.
Thus, when using the osgi
namespace to enclose
set
, list
or
reference
elements, one can use:
default-timeout
-
can be used to specify the default timeout (in milliseconds) for all
importer elements that do not explicitly specify one. For
example:
<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:default-timeout="5000"> <reference id="someService" interface="com.xyz.AService" .../> <reference id="someOtherService" interface="com.xyz.BService" timeout="1000" .../> </beans:beans>
Declare | |
Declare | |
This | |
This |
default-cardinality
-
can be used to specify the default cardinality for all
importer elements that do not explicitly specify one.
Possible values are 0..X
and 1..X
where X
is substituted at runtime to 1
for reference
elements or N
for collection types such as set
or list
.
Consider the following example:
<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:osgi="http://www.springframework.org/schema/osgi" osgi:default-cardinality="0..X" default-lazy-init="false"> <reference id="someService" interface="com.xyz.AService"/> <set id="someSetOfService" interface="com.xyz.BService"/> <list id="anotherListOfServices" interface="com.xyz.CService" cardinality="1..N"/> </beans:beans>
Declare Spring Dynamic Modules schema as the default namespace. | |
Import Spring Framework beans schema and associate a prefix with its namespace
( | |
Import Spring Dynamic Modules schema and associate a prefix with its namespace
( | |
Declare | |
| |
The | |
The | |
The |
The default-*
attributes allow for concise and shorter declarations as well
as easy propagation of changes (such as increasing or decreasing the timeout).