reintroduced createInstance() template method in deprecated form (SPR-7428)

This commit is contained in:
Juergen Hoeller 2010-08-07 11:16:46 +00:00
parent 9ef47b82a5
commit b054ca4a48
1 changed files with 33 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -66,7 +66,7 @@ public class PropertiesFactoryBean extends PropertiesLoaderSupport
public final void afterPropertiesSet() throws IOException {
if (this.singleton) {
this.singletonInstance = mergeProperties();
this.singletonInstance = createProperties();
}
}
@ -75,7 +75,7 @@ public class PropertiesFactoryBean extends PropertiesLoaderSupport
return this.singletonInstance;
}
else {
return mergeProperties();
return createProperties();
}
}
@ -83,4 +83,34 @@ public class PropertiesFactoryBean extends PropertiesLoaderSupport
return Properties.class;
}
/**
* Template method that subclasses may override to construct the object
* returned by this factory. The default implementation returns the
* plain merged Properties instance.
* <p>Invoked on initialization of this FactoryBean in case of a
* shared singleton; else, on each {@link #getObject()} call.
* @return the object returned by this factory
* @throws IOException if an exception occured during properties loading
* @see #mergeProperties()
*/
protected Properties createProperties() throws IOException {
return (Properties) createInstance();
}
/**
* Template method that subclasses may override to construct the object
* returned by this factory. The default implementation returns the
* plain merged Properties instance.
* <p>Invoked on initialization of this FactoryBean in case of a
* shared singleton; else, on each {@link #getObject()} call.
* @return the object returned by this factory
* @throws IOException if an exception occured during properties loading
* @deprecated as of Spring 3.0, in favor of {@link #createProperties()}
*/
@Deprecated
protected Object createInstance() throws IOException {
return mergeProperties();
}
}