java - Osgi Property Placeholder -
i can use string binding here, enablerequestvalidation should string, put in bean want use boolean, how can achieve using property-placeholder bindings?
<property-placeholder persistent-id="jsonvalidator" update-strategy="reload" placeholder-prefix="$[" placeholder-suffix="]"> <default-properties> <property name="enablerequestvalidation" value="false"></property> </default-properties> </property-placeholder> <bean id="jsonschemaregistration" class="rest.service.impl.jsonschema.jsonschemadynamicfeatureimpl"> <property name="enablerequestvalidation" value="$[enabledrequestvalidation]"></property> </bean>
addition exception below
2016-11-08 11:25:34,944 | error | thread-74 | blueprintcontainerimpl | 15 - org.apache.aries.blueprint.core - 1.4.4 | unable start blueprint container bundle core.rest.service.impl/0.6.0.snap shot org.osgi.service.blueprint.container.componentdefinitionexception: error setting property: propertydescriptor <name: enablerequestvalidation, getter: class core.rest.service.impl.jsonschema.jsonschemadynamicfeaturei mpl.isenablerequestvalidation(), setter: [class jsonschemadynamicfeatureimpl.setenablerequestvalidati on(boolean)] @ org.apache.aries.blueprint.container.beanrecipe.setproperty(beanrecip e.java:939)[15:org.apache.aries.blueprint.core:1.4.4] @ org.apache.aries.blueprint.container.beanrecipe.setproperties(beanrec ipe.java:905)[15:org.apache.aries.blueprint.core:1.4.4] @ org.apache.aries.blueprint.container.beanrecipe.setproperties(beanrec ipe.java:886)[15:org.apache.aries.blueprint.core:1.4.4]
are able use aries blueprint configuration managagement? don't provide information environment is, using servicemix, time. example:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:config="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" xsi:schemalocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/smlns/blueprint/v1.0.0/blueprint.xsd"> <!-- osgi blueprint property placeholder binding configuration file --> <config:property-placeholder id="myprops.props" persistent-id="myprops" update-strategy="reload"> <config:default-properties> <config:property name="my.setting" value="true" /> </config:default-properties> </config:property-placeholder> <bean id="mybean" class="org.me.myclass"> <property name="setting" value="${my.setting}" /> </bean> </blueprint>
note inclusion of verion 1.1.0 of blueprint-cm namespace, supports update-strategy setting. property injection find setsetting(boolean setting) method , attempt convert string boolean value. here default value of "true" specified, can overridden changes etc/myprops.cfg.
Comments
Post a Comment