Uploaded image for project: 'GeoServer'
  1. GEOS-8003

Control-flow access beans through GeoServerExtensions in BeanFactoryPostProcessor callbacks

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9.5, 2.10.4, 2.11-RC1
    • Component/s: Control-flow
    • Labels:
      None

      Description

      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 JavaDoc 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.
      (...)
      

      It 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.

        Attachments

          Activity

            People

            • Assignee:
              nmco Nuno Oliveira
              Reporter:
              nmco Nuno Oliveira
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: