diff --git a/spring-resources/spring-resource-documentLoader/README.md b/spring-resources/spring-resource-documentLoader/README.md index ea12cd7..f461bca 100644 --- a/spring-resources/spring-resource-documentLoader/README.md +++ b/spring-resources/spring-resource-documentLoader/README.md @@ -13,7 +13,7 @@ ### 一、基本信息 -✒️ **作者** - Lex 📝 **博客** [掘金](https://juejin.cn/user/4251135018533068/posts) 📚 **源码地址** - [github](https://github.com/xuchengsheng/spring-reading) +✒️ **作者** - Lex 📝 - **博客** [掘金](https://juejin.cn/user/4251135018533068/posts) 📚 **源码地址** - [github](https://github.com/xuchengsheng/spring-reading) ### 二、知识储备 diff --git a/spring-resources/spring-resource-propertiesPersister/pom.xml b/spring-resources/spring-resource-propertiesPersister/pom.xml new file mode 100644 index 0000000..4259227 --- /dev/null +++ b/spring-resources/spring-resource-propertiesPersister/pom.xml @@ -0,0 +1,19 @@ + + + + spring-resources + com.xcs.spring + 0.0.1-SNAPSHOT + + 4.0.0 + + spring-resource-propertiesPersister + + + 11 + 11 + + + \ No newline at end of file diff --git a/spring-resources/spring-resource-propertiesPersister/src/main/java/com/xcs/spring/PropertiesPersisterDemo.java b/spring-resources/spring-resource-propertiesPersister/src/main/java/com/xcs/spring/PropertiesPersisterDemo.java new file mode 100644 index 0000000..02c3fd9 --- /dev/null +++ b/spring-resources/spring-resource-propertiesPersister/src/main/java/com/xcs/spring/PropertiesPersisterDemo.java @@ -0,0 +1,24 @@ +package com.xcs.spring; + +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.support.ResourcePropertiesPersister; +import org.springframework.util.PropertiesPersister; + +import java.io.IOException; +import java.util.Properties; + +/** + * @author xcs + * @date 2023年11月09日 15时38分 + **/ +public class PropertiesPersisterDemo { + + public static void main(String[] args) throws IOException { + Properties loadProperties = new Properties(); + + PropertiesPersister propertiesPersister = ResourcePropertiesPersister.INSTANCE; + propertiesPersister.load(loadProperties, new ClassPathResource("bean-definitions.properties").getInputStream()); + + System.out.println("loadProperties = " + loadProperties); + } +} diff --git a/spring-resources/spring-resource-propertiesPersister/src/main/resources/bean-definitions.properties b/spring-resources/spring-resource-propertiesPersister/src/main/resources/bean-definitions.properties new file mode 100644 index 0000000..6b16993 --- /dev/null +++ b/spring-resources/spring-resource-propertiesPersister/src/main/resources/bean-definitions.properties @@ -0,0 +1,4 @@ +myBean.(class)=com.xcs.spring.bean.MyBean +myBean.message=hello world +myBean.(lazy-init)=true +myBean.(scope)=prototype \ No newline at end of file diff --git a/spring-resources/spring-resource-propertiesPersister/src/main/resources/beans.xml b/spring-resources/spring-resource-propertiesPersister/src/main/resources/beans.xml new file mode 100644 index 0000000..bffb38f --- /dev/null +++ b/spring-resources/spring-resource-propertiesPersister/src/main/resources/beans.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/spring-resources/spring-resource-resourceLoader/README.md b/spring-resources/spring-resource-resourceLoader/README.md index 58938dd..37b89c3 100644 --- a/spring-resources/spring-resource-resourceLoader/README.md +++ b/spring-resources/spring-resource-resourceLoader/README.md @@ -14,7 +14,7 @@ ### 一、基本信息 -✒️ **作者** - Lex 📝 **博客** [掘金](https://juejin.cn/user/4251135018533068/posts) 📚 **源码地址** - [github](https://github.com/xuchengsheng/spring-reading) +✒️ **作者** - Lex 📝 **博客** - [掘金](https://juejin.cn/user/4251135018533068/posts) 📚 **源码地址** - [github](https://github.com/xuchengsheng/spring-reading) ### 二、知识储备 diff --git a/spring-resources/spring-resource/README.md b/spring-resources/spring-resource/README.md index 9b53e47..2189b83 100644 --- a/spring-resources/spring-resource/README.md +++ b/spring-resources/spring-resource/README.md @@ -14,7 +14,7 @@ ### 一、基本信息 -✒️ **作者** - Lex 📝 **博客** [掘金](https://juejin.cn/user/4251135018533068/posts) 📚 **源码地址** - [github](https://github.com/xuchengsheng/spring-reading) +✒️ **作者** - Lex 📝 **博客** - [掘金](https://juejin.cn/user/4251135018533068/posts) 📚 **源码地址** - [github](https://github.com/xuchengsheng/spring-reading) ### 二、知识储备