private static final Log log = Log.getInstance(SpringInjectionPostProcessor.class);
private ServletContext servletContext;
/** Get the servlet context from the object factory's configuration. */
public void setObjectFactory(DefaultObjectFactory factory) {
Configuration configuration = factory.getConfiguration();
if (configuration == null) {
final String name = getClass().getSimpleName();
throw new IllegalStateException("The object factory passed to " + name
+ " has no configuration. The configuration is required by " + name
+ " to get the servlet context.");
}
ServletContext servletContext = configuration.getServletContext();
if (this.servletContext != null && this.servletContext != servletContext) {
final String name = getClass().getSimpleName();
throw new IllegalStateException("An attempt was made to use a single instance of "
+ name + " in two different servlet contexts. " + name + " instances "
+ "cannot be shared across servlet contexts.");