Github user jtstorck commented on a diff in the pull request:
https://github.com/apache/nifi/pull/526#discussion_r66968299
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml
---
@@ -114,7 +123,23 @@
<property name="keyService" ref="keyService"/>
<property name="dtoFactory" ref="dtoFactory"/>
</bean>
+ <bean id="authorizableLookup"
class="org.apache.nifi.web.StandardAuthorizableLookup">
+ <property name="controllerFacade" ref="controllerFacade"/>
+ <property name="processorDAO" ref="processorDAO"/>
+ <property name="inputPortDAO" ref="inputPortDAO"/>
+ <property name="outputPortDAO" ref="outputPortDAO"/>
+ <property name="processGroupDAO" ref="processGroupDAO"/>
+ <property name="remoteProcessGroupDAO"
ref="remoteProcessGroupDAO"/>
+ <property name="labelDAO" ref="labelDAO"/>
+ <property name="funnelDAO" ref="funnelDAO"/>
+ <property name="connectionDAO" ref="connectionDAO"/>
+ <property name="controllerServiceDAO" ref="controllerServiceDAO"/>
+ <property name="reportingTaskDAO" ref="reportingTaskDAO"/>
+ <property name="templateDAO" ref="templateDAO"/>
+ <property name="snippetDAO" ref="snippetDAO"/>
+ </bean>
<bean id="serviceFacade"
class="org.apache.nifi.web.StandardNiFiServiceFacade">
+ <constructor-arg ref="authorizableLookup" />
--- End diff --
I prefer constructor injection over setter injection. I think it's best
that once an object is constructed, it should be usable, and that's not
possible with setter injection. With setters needing to be used to configure
the object, there's no way to indicate required versus optional properties,
outside of documentation. By using constructors, you can programmatically
declare the required properties. This has an added benefit (in my opinion) of
working towards making these types of objects (resources, services) immutable,
and I think, generally speaking, immutability moves towards easier testing.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---