I would like to override the getProperty() method in java.util.Properties class ,Please advise.
1.Spring Context file
spring-context.xml
<bean id="myproperty" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations" value="classpath:myproperties.properties" />
</bean>
2. Java Class
public class MyClass{
@Autowired
public void setMyproperty(Properties myproperty) {
this.url=myproperty.getProperty("url");
}
}
3.Config file
myproperties.properties
url=http://stackoverflow.com
Fyi : I am pulling out lot values from config file and i would like to invoke trim() once i get the value from .properties, to avoid code redundancy trying to override the getProperty() method.
Using :Spring 4.0