Class StrutsBeanSelectionProvider

java.lang.Object
org.apache.struts2.config.AbstractBeanSelectionProvider
org.apache.struts2.config.StrutsBeanSelectionProvider
All Implemented Interfaces:
BeanSelectionProvider, ConfigurationProvider, ContainerProvider, PackageProvider

public class StrutsBeanSelectionProvider extends AbstractBeanSelectionProvider
Selects the implementations of key framework extension points, using the loaded property constants. The implementations are selected from the container builder using the name defined in its associated property. The default implementation name will always be "struts".

The following is a list of the allowed extension points:

Type Property Scope Description
org.apache.struts2.ObjectFactory struts.objectFactory singleton Creates actions, results, and interceptors
org.apache.struts2.factory.ActionFactory struts.objectFactory.actionFactory singleton Dedicated factory used to create Actions, you can implement/extend existing one instead of defining new ObjectFactory
org.apache.struts2.factory.ResultFactory struts.objectFactory.resultFactory singleton Dedicated factory used to create Results, you can implement/extend existing one instead of defining new ObjectFactory
org.apache.struts2.factory.InterceptorFactory struts.objectFactory.interceptorFactory singleton Dedicated factory used to create Interceptors, you can implement/extend existing one instead of defining new ObjectFactory
org.apache.struts2.factory.ConverterFactory struts.objectFactory.converterFactory singleton Dedicated factory used to create TypeConverters, you can implement/extend existing one instead of defining new ObjectFactory
org.apache.struts2.factory.ValidatorFactory struts.objectFactory.validatorFactory singleton Dedicated factory used to create Validators, you can implement/extend existing one instead of defining new ObjectFactory
org.apache.struts2.ActionProxyFactory struts.actionProxyFactory singleton Creates the ActionProxy
org.apache.struts2.util.ObjectTypeDeterminer struts.objectTypeDeterminer singleton Determines what the key and element class of a Map or Collection should be
org.apache.struts2.dispatcher.mapper.ActionMapper struts.mapper.class singleton Determines the ActionMapping from a request and a URI from an ActionMapping
org.apache.struts2.dispatcher.multipart.MultiPartRequest struts.multipart.parser per request Parses a multipart request (file upload)
org.apache.struts2.views.freemarker.FreemarkerManager struts.freemarker.manager.classname singleton Loads and processes Freemarker templates
org.apache.struts2.views.velocity.VelocityManager struts.velocity.manager.classname singleton Loads and processes Velocity templates
org.apache.struts2.validator.ActionValidatorManager struts.actionValidatorManager singleton Main interface for validation managers (regular and annotation based). Handles both the loading of configuration and the actual validation (since 2.1)
org.apache.struts2.util.ValueStackFactory struts.valueStackFactory singleton Creates value stacks (since 2.1)
org.apache.struts2.reflection.ReflectionProvider struts.reflectionProvider singleton Provides reflection services, key place to plug in a custom expression language (since 2.1)
org.apache.struts2.reflection.ReflectionContextFactory struts.reflectionContextFactory singleton Creates reflection context maps used for reflection and expression language operations (since 2.1)
org.apache.struts2.config.PackageProvider N/A singleton All beans registered as PackageProvider implementations will be automatically included in configuration building (since 2.1)
org.apache.struts2.util.PatternMatcher struts.patternMatcher singleton Matches patterns, such as action names, generally used in configuration (since 2.1)
org.apache.struts2.views.dispatcher.DefaultStaticContentLoader struts.staticContentLoader singleton Loads static resources (since 2.1)
org.apache.struts2.conversion.impl.XWorkConverter struts.xworkConverter singleton Handles conversion logic and allows to load custom converters per class or per action
org.apache.struts2.TextProvider struts.textProvider default Allows provide custom TextProvider for whole application, it's better to use struts.textProviderFactory
org.apache.struts2.TextProviderFactory struts.textProviderFactory default Allows provide custom TextProviderFactory for whole application
org.apache.struts2.LocaleProviderFactory struts.localeProviderFactory singleton Allows provide custom LocaleProvider for whole application
org.apache.struts2.components.UrlRenderer struts.urlRenderer singleton Allows provide custom implementation of environment specific URL rendering/creating class
org.apache.struts2.UnknownHandlerManager struts.unknownHandlerManager singleton Implementation of this interface allows handle logic of unknown Actions, Methods or Results
org.apache.struts2.views.util.UrlHelper struts.view.urlHelper singleton Helper class used with URLRenderer to provide exact logic for building URLs
org.apache.struts2.FileManagerFactory struts.fileManagerFactory singleton Used to create FileManager instance to access files on the File System as also to monitor if reload is needed, can be implemented / overwritten to meet specific an application server needs
org.apache.struts2.conversion.impl.CollectionConverter struts.converter.collection singleton Converter used to convert any object to Collection and back
org.apache.struts2.conversion.impl.ArrayConverter struts.converter.array singleton Converter used to convert any object to Array and back
org.apache.struts2.conversion.impl.DateConverter struts.converter.date singleton Converter used to convert any object to Date and back
org.apache.struts2.conversion.impl.NumberConverter struts.converter.number singleton Converter used to convert any object to Number and back
org.apache.struts2.conversion.impl.StringConverter struts.converter.string singleton Converter used to convert any object to String and back
org.apache.struts2.conversion.ConversionPropertiesProcessor struts.conversion.properties.processor singleton Process Properties to create converters
org.apache.struts2.conversion.ConversionPropertiesProcessor struts.converter.file.processor singleton Process <class>-conversion.properties file create converters</class>
org.apache.struts2.conversion.ConversionAnnotationProcessor struts.converter.annotation.processor singleton Process TypeConversion annotation to create converters
org.apache.struts2.conversion.TypeConverterCreator struts.converter.creator singleton Creates user converters
org.apache.struts2.conversion.TypeConverterHolder struts.converter.holder singleton Holds user converters' instances
org.apache.struts2.util.TextParser struts.expression.parser singleton Used to parse expressions like ${foo.bar} or %{bar.foo} but it is up tp the TextParser's implementation what kind of opening char to use (#, $, %, etc)
org.apache.struts2.ExcludedPatternsChecker struts.excludedPatterns.checker request Used across different interceptors to check if given string matches one of the excluded patterns
org.apache.struts2.AcceptedPatternsChecker struts.acceptedPatterns.checker request Used across different interceptors to check if given string matches one of the accepted patterns
org.apache.struts2.util.ContentTypeMatcher struts.contentTypeMatcher singleton Matches content type of uploaded files (since 2.3.22)
org.apache.struts2.LocalizedTextProvider struts.localizedTextProvider singleton Provides access to resource bundles used to localise messages (since 2.5.11)

Implementations are selected using the value of its associated property. That property is used to determine the implementation by:

  1. Trying to find an existing bean by that name in the container
  2. Trying to find a class by that name, then creating a new bean factory for it
  3. Creating a new delegation bean factory that delegates to the configured ObjectFactory at runtime

Finally, this class overrides certain properties if dev mode is enabled:

  • struts.i18n.reload = true
  • struts.configuration.xml.reload = true
  • Constructor Details

    • StrutsBeanSelectionProvider

      public StrutsBeanSelectionProvider()
  • Method Details

    • register

      public void register(ContainerBuilder builder, LocatableProperties props)
      Description copied from interface: ContainerProvider
      Registers beans and properties for the Container
      Parameters:
      builder - The builder to register beans with
      props - The properties to register constants with