[Geoserver-devel] [JIRA] (GEOS-8003) Control-flow access beans through GeoServerExtensions in BeanFactoryPostProcessor callbacks

Nuno Oliveira created an issue

GeoServer / BugGEOS-8003

Control-flow access beans through GeoServerExtensions in BeanFactoryPostProcessor callbacks

Issue Type:

BugBug

Assignee:

Nuno Oliveira

Components:

Control-flow

Created:

22/Feb/17 12:56 AM

Environment:

Priority:

MediumMedium

Reporter:

Nuno Oliveira

Control-flow access beans through GeoServerExtensions in BeanFactoryPostProcessor callbacks, this may provoke premature beans instantiations provoking Spring beans initialization errors:
https://github.com/geoserver/geoserver/blob/master/src/extension/control-flow/src/main/java/org/geoserver/flow/ControlFlowCallback.java#L192-L236

A way to reproduce this problem is to use control-flow extension along with geofence-server module, geofence-server properties placeholders will not be properly initialized before geofence-server beans instantiation.

Note that BeanFactoryPostProcessor actually warns us against this:

(...)
 * <p>A BeanFactoryPostProcessor may interact with and modify bean
 * definitions, but never bean instances. Doing so may cause premature bean
 * instantiation, violating the container and causing unintended side-effects.
 * If bean instance interaction is required, consider implementing
 * {@link BeanPostProcessor} instead.
(...)

I seems to me that the only propose of the current callbacks is to make sure that Spring beans are actually created when the default FlowControllerProvider and default ControlFlowConfigurator are used so this beans can later be retrieved using the GeoExtensions class.

A use case that justify this is when the importer needs to find all the beans that implement the GeoServerPluginConfigurator interface, for example.

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v1000.773.2#100032-sha1:6cd161b)

Atlassian logo