1.PropertyPlaceholderConfigurer class
It replaces the defined variable (var) in the attribute with a placeholder for ${var} in the spring's configuration file
Jdbc.driverclassname=org.hsqldb.jdbcdriver
jdbc.url=jdbc:hsqldb:hsql://production:9002
Jdbc.username=sa
Jdbc.password=root 2.PropertyOverrideConfigurer Class
Same as Propertyplaceholderconfigurer function, but the usage is different. Do not use placeholders, in the
Two methods:-----------------------------------1---------------------------------------------------------------2----------------------------(Example reference above spring configuration)This article is from the "Oriental Pavilion" blog, please be sure to keep this source http://lailai.blog.51cto.com/3362373/1558004Spring Load Configuration Properties File (proper
sets the number of seconds to load performance of cache files by default-1--This article from "has been climbing the pit" blog, declined reprint! Spring configures internationalized message resource files (. properties)
Write information to the properties file (Summary of failed properties File Retrieval) and write properties
Some time ago, the project needs to dynamically write a property to the properties
For a property configuration, you typically use the form of a key-value pair, such as:
Key=value
Property profiles generally use xxx.properties, and of course sometimes in order to avoid eclipse of the properties file transcoding, on the server do not recognize Chinese, you can use the form of xxx.conf management property configuration.
Spring has its own way of
For a property configuration, you typically use the form of a key-value pair, such as:
Key=value
Property profiles generally use xxx.properties, and of course sometimes in order to avoid eclipse of the properties file transcoding, on the server do not recognize Chinese, you can use the form of xxx.conf management property configuration.
Spring has its own way of
Spring MVC reads the configuration content of. properties through the @ Value annotation, @ value. properties
Step 1:
Configure in applicationContext. xml:
1
Step 2:
Create a configuration file:
Example: userPageSize = 5
Step 3:
Use annotations in the Controller to obtain the configuration item content:
1 @Value(
that references the car is called the reference internal Bean).The second is to assign a value to the cascading property:Cascading properties is also a bluff name:Cascading properties as the name implies is the thing between the property and the property, the constructor injected ref= "Car", the following can be assigned to the property of car, this understanding is more simpleperson has a name age and a c
Previous Article Spring Management property configuration file properties-- Use Propertiesfactorybean to refer to the use of Org.springframework.beans.factory.config.PropertiesFactoryBean management properties files, found in the learning process through Org.springfram Ework.beans.factory.config.PropertyPlaceholderConf
Java reads and writes the properties configuration file, and the properties configuration file1.1. Read the properties configuration file 1.1.1. The file to be read
You can use the colon [:] and equal sign [=] between the key and
Method One: You can pass the load () method of the Java.util.Properties class
1
InputStreamin=lnewBufferedInputStream(newFileInputStream(name));
2
Propertiesp=newProperties();
3
p.load(in);
Method Two: Use spring to read the properties configuration fileOrg.springframework.beans.factory.support.PropertiesBeanDe
Introduction of properties File
The properties file in Java is a configuration file, mainly used to express configuration information, the file type is *.properties, the format is a tex
name;7.}8. Public void setName (String name) {9. this. Name = name;10.}One. public String Getgender () {return gender;13.}Public void Setgender (String gender) {. This . gender = gender;16.}17.18.}Finally note the Spring boot entry class plus @enableconfigurationproperties1. @SpringBootApplication2. @EnableConfigurationProperties ({wiselysettings. Class, Wisely2settings. class})3. Public class DemoApplication {4.5. Public static void main (string[]
Use Properties to read the configuration file and obtain the specific content value. properties configuration file
Sometimes, when writing a configuration file, you need to know whether the read content is correct. We need to test it to see if the read content is the same as
-Ltotal64Drwx R-x R-x 2Root root4096 feb 15 14 :46 Crond rwx r - x r - x 34096 apr 212014 MySQL This means that the root user group is not modifiable for other user groupsIn the above example, the MySQL file is a directory file, both the owner and the group are MySQL,The owner has a readable, writable, executable permission;Other users in the same group as the owner have readable and executable
How to view file properties, how to change file properties
In WinXP, data is managed by files, and different data files are different, such as text, music, video and so on, they all have different attributes;
1, file properties
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.