[
https://issues.apache.org/jira/browse/FELIX-6589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17681969#comment-17681969
]
Jürgen Albert commented on FELIX-6589:
--------------------------------------
I guess we can ignore the unbind method. In the Version with the Method
binding, update is called when the properties of the Service Change, which is
what we need/want.
I have tried to find something in the Spec for this case, but I haven't found
anything that really fits the given case. It's possible that I've missed
something though.
> update method with constructor injection does not work
> ------------------------------------------------------
>
> Key: FELIX-6589
> URL: https://issues.apache.org/jira/browse/FELIX-6589
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Affects Versions: scr-2.2.6
> Reporter: Jürgen Albert
> Priority: Major
>
> I have a scenario, where I use constructor injection and on one of the
> references I get an update method is defined. When the properties of the
> registered service change the update method is never called however.
> When I move the Reference from the constructor to a usual bind method, or
> even with a duplicated on it works like a charm.
> The Constructor looks as follows:
> {code:java}
> public DefaultResourceSetFactoryComponent(ComponentContext ctx,
> @Reference(name="resourceFactoryRegistry",
> unbind="unsetResourceFactoryRegistry", updated =
> "modifiedResourceFactoryRegistry")
> ServiceReference<Resource.Factory.Registry>
> resourceFactoryRegistryReference
> ) {
> {code}
> The bind method that works looks as follows:
> {code:java}
> @Reference(policy=ReferencePolicy.STATIC,
> unbind="unsetResourceFactoryRegistry", updated =
> "modifiedResourceFactoryRegistry")
> public void setResourceFactoryRegistry(Resource.Factory.Registry
> resourceFactoryRegistry, Map<String, Object> properties) {
> {code}
> Both update methodes are mentioned correctly in the resulting component xml.
> I also played around with ComponentServiceObjects, ServiceReference and the
> service itself. Result stays the same.
> If the Spec says that this is the correct behavior that I can't fin the
> passage.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)