Package org.springframework.web.context.support

# Class ServletContextParameterFactoryBean

java.lang.Object
org.springframework.web.context.support.ServletContextParameterFactoryBean

All Implemented Interfaces:
  `org.springframework.beans.factory.Aware`, `org.springframework.beans.factory.FactoryBean<String>`, `ServletContextAware`

public class ServletContextParameterFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<String>, ServletContextAware
`FactoryBean` that retrieves a specific ServletContext init parameter (that is, a "context-param" defined in `web.xml`). Exposes that ServletContext init parameter when used as bean reference, effectively making it available as named Spring bean instance.

NOTE: You may also use the "contextParameters" default bean, which is of type Map, and dereference it using a "#{contextParameters.myKey}" expression to access a specific parameter by name.

Since:
  1.2.4
Author:
  Juergen Hoeller
See Also:
  - `WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME`
  - `ServletContextAttributeFactoryBean`

## Field Summary

### Fields inherited from interface org.springframework.beans.factory.FactoryBean

`OBJECT_TYPE_ATTRIBUTE`

## Constructor Summary

Constructors
Constructor
Description
`ServletContextParameterFactoryBean()`

## Method Summary

Modifier and Type
Method
Description
`String`
`getObject()`
`Class<String>`
`getObjectType()`
`boolean`
`isSingleton()`
`void`
`setInitParamName(String initParamName)`
Set the name of the ServletContext init parameter to expose.
`void`
`setServletContext(ServletContext servletContext)`
Set the `ServletContext` that this object runs in.

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ServletContextParameterFactoryBean

public ServletContextParameterFactoryBean()

## Method Details

### setInitParamName

public void setInitParamName(String initParamName)
Set the name of the ServletContext init parameter to expose.

### setServletContext

public void setServletContext(ServletContext servletContext)
Description copied from interface: `ServletContextAware`
Set the `ServletContext` that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's `afterPropertiesSet` or a custom init-method. Invoked after ApplicationContextAware's `setApplicationContext`.

Specified by:
  `setServletContext` in interface `ServletContextAware`
Parameters:
  `servletContext` - the ServletContext object to be used by this object
See Also:
  - `InitializingBean.afterPropertiesSet()`
  - `ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)`

### getObject

@Nullable public String getObject()

Specified by:
  `getObject` in interface `org.springframework.beans.factory.FactoryBean<String>`

### getObjectType

public Class<String> getObjectType()

Specified by:
  `getObjectType` in interface `org.springframework.beans.factory.FactoryBean<String>`

### isSingleton

public boolean isSingleton()

Specified by:
  `isSingleton` in interface `org.springframework.beans.factory.FactoryBean<String>`