To understand this class first you need to figure out a concept: Bean factory Post-processor
The official explanation is this:
A bean factory Post-processor is a Java class which implements the
Org.springframework.beans.factory.config.BeanFactoryPostProcessor interface. It is executed manually (in the case of the Beanfactory) or automatically (in the case of the ApplicationContext) to APPL Y changes of some sort to a entire beanfactory, after it had been constructed.
I understand the meaning of this:
1. First The Bean factory Post-processor implements the Org.springframework.beans.factory.config.BeanFactoryPostProcessor interface.
2. In the case of beanfactory it is executed manually.
3. It will execute automatically under applicationcontext conditions.
4. The most critical point is that after an instance of a class is constructed, the entire beanfactory is modified.
Then the Propertyplaceholderconfigurer class is a bean factory post-processor, its role is a resource property of the Configurator, The ability to place content defined in the beanfactory in a file with the. propertis suffix.
For example
${driver}
Jdbc:${dbname}
and the actual Jdbc.propertis file is
Jdbc.driverclassname=org.hsqldb.jdbcdriver
jdbc.url=jdbc:hsqldb:hsql://production:9002
Jdbc.username=sa
Jdbc.password=root
And how Jdbc.propertis is quoted:
---spring-context.xml----
/web-inf/jdbc.properties
Registering the upper section of the configuration in Web. XML is possible
Contextconfiglocation
/web-inf/spring-context.xml
Of course, don't forget spring's listener registration
Org.springframework.web.context.ContextLoaderListener
In this way, a simple data source is set up.
In fact, the role of Propertyplaceholderconfigurer is to place the database configuration information pointed to by the placeholder in the bean definition
The tool.
Brief analysis of Propertyplaceholderconfigurer class under Spring Frame [reprint]