com.opensymphony.xwork2.config.providers

## Class XmlConfigurationProvider

- java.lang.Object
- - com.opensymphony.xwork2.config.providers.XmlDocConfigurationProvider
  - - com.opensymphony.xwork2.config.providers.XmlConfigurationProvider

- All Implemented Interfaces:
    ConfigurationProvider, ContainerProvider, PackageProvider
  Direct Known Subclasses:
    StrutsXmlConfigurationProvider

      public abstract class XmlConfigurationProvider
      extends XmlDocConfigurationProvider

  Looks in the classpath for an XML file, "struts.xml" by default, and uses it for the XWork configuration.
  Version:
    $Revision$
  Author:
    tmjee, Rainer Hermanns, Neo

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected FileManager` | `fileManager`

    - ### Fields inherited from class com.opensymphony.xwork2.config.providers.XmlDocConfigurationProvider

      `allowlistClasses, configuration, declaredPackages, documents, dtdMappings, objectFactory, providerAllowlist, throwExceptionOnDuplicateBeans, valueSubstitutor`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XmlConfigurationProvider()`
    `XmlConfigurationProvider(String filename)`
    `XmlConfigurationProvider(String filename, boolean notUsed)` Deprecated. since 6.2.0, use `XmlConfigurationProvider(String)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `protected Iterator<URL>` | `getConfigurationUrls(String fileName)`
    `protected List<Document>` | `getDocs(Iterator<URL> urls, String fileName, Element includeElement)`
    `protected List<Document>` | `getFinalDocs(List<Document> docs)`
    `protected Iterator<URL>` | `getURLs(String fileName)`
    `int` | `hashCode()`
    `void` | `init(Configuration configuration)` Initializes with the configuration
    `protected List<Document>` | `loadConfigurationFiles(String fileName, Element includeElement)`
    `void` | `loadPackages()` Loads the packages for the configuration.
    `boolean` | `needsReload()` Tells whether the ConfigurationProvider should reload its configuration.
    `protected List<Document>` | `parseFile(String configFileName)`
    `void` | `register(ContainerBuilder containerBuilder, LocatableProperties props)` Registers beans and properties for the Container
    `void` | `setFileManagerFactory(FileManagerFactory fileManagerFactory)`
    `String` | `toString()`

    - ### Methods inherited from class com.opensymphony.xwork2.config.providers.XmlDocConfigurationProvider

      `addAction, addAllowedMethodsToSet, addPackage, addResultTypes, allowAndLoadClass, buildActionConfig, buildAllowedMethods, buildExceptionMappings, buildExceptionMappings, buildInterceptorConfig, buildInterceptorList, buildPackageContext, buildResultConfig, buildResultParams, buildResults, buildResultTypeConfig, destroy, getDtdMappings, guessResultType, iterateChildren, iterateChildrenByTagName, iterateElementChildren, iterateElementChildren, loadClass, loadDefaultActionRef, loadDefaultClassRef, loadDefaultInterceptorRef, loadExtraConfiguration, loadGlobalAllowedMethods, loadGlobalExceptionMappings, loadGlobalResults, loadInterceptors, loadInterceptorStack, loadInterceptorStacks, lookupInterceptorReference, registerBean, registerBeanSelection, registerConstant, registerUnknownHandlerStack, setDtdMappings, setObjectFactory, setProviderAllowlist, setThrowExceptionOnDuplicateBeans, setValueSubstitutor, verifyAction, verifyAction, verifyInterceptor, verifyResultType`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### fileManager

          protected FileManager fileManager

  - ### Constructor Detail

    - #### XmlConfigurationProvider

          public XmlConfigurationProvider()

    - #### XmlConfigurationProvider

          public XmlConfigurationProvider(String filename)

    - #### XmlConfigurationProvider

          @Deprecated
          public XmlConfigurationProvider(String filename,
                                                      @Deprecated
                                                      boolean notUsed)

      Deprecated. since 6.2.0, use `XmlConfigurationProvider(String)`

  - ### Method Detail

    - #### setFileManagerFactory

          public void setFileManagerFactory(FileManagerFactory fileManagerFactory)

    - #### init

          public void init(Configuration configuration)

      Description copied from interface: `ContainerProvider`
      Initializes with the configuration
      Specified by:
        `init` in interface `ContainerProvider`
      Specified by:
        `init` in interface `PackageProvider`
      Overrides:
        `init` in class `XmlDocConfigurationProvider`
      Parameters:
        `configuration` - The configuration

    - #### loadPackages

          public void loadPackages()
                            throws ConfigurationException

      Description copied from interface: `PackageProvider`
      Loads the packages for the configuration.
      Specified by:
        `loadPackages` in interface `PackageProvider`
      Overrides:
        `loadPackages` in class `XmlDocConfigurationProvider`
      Throws:
        `ConfigurationException` - in case of configuration errors

    - #### register

          public void register(ContainerBuilder containerBuilder,
                               LocatableProperties props)
                        throws ConfigurationException

      Description copied from interface: `ContainerProvider`
      Registers beans and properties for the Container
      Specified by:
        `register` in interface `ContainerProvider`
      Overrides:
        `register` in class `XmlDocConfigurationProvider`
      Parameters:
        `containerBuilder` - The builder to register beans with
        `props` - The properties to register constants with
      Throws:
        `ConfigurationException` - If anything goes wrong

    - #### needsReload

          public boolean needsReload()

      Tells whether the ConfigurationProvider should reload its configuration. This method should only be called if ConfigurationManager.isReloadingConfigs() is true.
      Specified by:
        `needsReload` in interface `ContainerProvider`
      Specified by:
        `needsReload` in interface `PackageProvider`
      Overrides:
        `needsReload` in class `XmlDocConfigurationProvider`
      Returns:
        true if the file has been changed since the last time we read it

    - #### parseFile

          protected List<Document> parseFile(String configFileName)

    - #### loadConfigurationFiles

          protected List<Document> loadConfigurationFiles(String fileName,
                                                          Element includeElement)

    - #### getURLs

          protected Iterator<URL> getURLs(String fileName)

    - #### getConfigurationUrls

          protected Iterator<URL> getConfigurationUrls(String fileName)
                                                throws IOException

      Throws:
        `IOException`

    - #### getDocs

          protected List<Document> getDocs(Iterator<URL> urls,
                                           String fileName,
                                           Element includeElement)

    - #### getFinalDocs

          protected List<Document> getFinalDocs(List<Document> docs)

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.