From 66d061f8edd3c26129b50ea8249505b7e6ba6161 Mon Sep 17 00:00:00 2001 From: xuchengsheng Date: Thu, 9 Nov 2023 21:15:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96readme=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spring-resource-documentLoader/README.md | 2 +- .../pom.xml | 19 +++++++++++++++ .../xcs/spring/PropertiesPersisterDemo.java | 24 +++++++++++++++++++ .../resources/bean-definitions.properties | 4 ++++ .../src/main/resources/beans.xml | 5 ++++ .../spring-resource-resourceLoader/README.md | 2 +- spring-resources/spring-resource/README.md | 2 +- 7 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 spring-resources/spring-resource-propertiesPersister/pom.xml create mode 100644 spring-resources/spring-resource-propertiesPersister/src/main/java/com/xcs/spring/PropertiesPersisterDemo.java create mode 100644 spring-resources/spring-resource-propertiesPersister/src/main/resources/bean-definitions.properties create mode 100644 spring-resources/spring-resource-propertiesPersister/src/main/resources/beans.xml 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) ### 二、知识储备