Explain how to load the properties configuration file using spring
I remember that when writing a web project, the reading of the configuration file was completed with the class properties. At that time, no changes were made for the unification of the project code. But I've been wondering whether spring MVC will have all the annotation functions configured? Recent research shows that spring MVC does have this function, and spring is really powerful.
Because the code is very simple, I paste the code I tested and follow the steps to implement it.
Create a new configuration file JDBC properties
Create a new configuration file spring properties
New unit test
If you annotate properties in the above way, intelij idea will be prompted. Press and hold Ctrl and click the property 'username' to call it into the corresponding configuration file. This can also verify whether our configuration is effective.
Although I know how to use annotations to load configuration files, the differences and functions between properties factory bean and preferences placeholderconfigurer have not been clarified. In addition, spring's unit testing framework has not been studied. If you know, you can leave a message below to tell me. If no one answers, you can only have time to study it slowly in the future.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.