diff --git a/.gitignore b/.gitignore index ac4a37daab401242d78fa4768b8f13a5dfd504c0..8d5694413aea8db8576ae917df1288aa7b952d5f 100644 --- a/.gitignore +++ b/.gitignore @@ -86,3 +86,4 @@ buildNumber.properties .idea !/demo-parent.iml !/demo-parent.iml +!/.idea/ diff --git a/application.yml b/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..2b583ea0aa17305aa26c7e0a53906593a7917adf --- /dev/null +++ b/application.yml @@ -0,0 +1,4 @@ +server: + port: 8080 +#system: +# name: "root" diff --git a/config/application.yml b/config/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..56ec75328700330037d756a845d3a400122fff7c --- /dev/null +++ b/config/application.yml @@ -0,0 +1,4 @@ +server: + port: 8080 +#system: +# name: "root config" diff --git a/core/application.yml b/core/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..0c4af9914482002bbcdbe08e0b743c3149dd7ee8 --- /dev/null +++ b/core/application.yml @@ -0,0 +1,4 @@ +server: + port: 8080 +system: + name: "core" diff --git a/core/config/application.yml b/core/config/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..cf3688ffa8e6ed86aef4856b861cf896a4430186 --- /dev/null +++ b/core/config/application.yml @@ -0,0 +1,4 @@ +server: + port: 8080 +system: + name: "core config" diff --git a/core/core.iml b/core/core.iml new file mode 100644 index 0000000000000000000000000000000000000000..d681e717c749196816cab88f51bba98fcc38d5b7 --- /dev/null +++ b/core/core.iml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/pom.xml b/core/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..8175d84c7845acdbacbf31fe291dd4a2bc112c31 --- /dev/null +++ b/core/pom.xml @@ -0,0 +1,26 @@ + + + + demo-parent + com.duanledexianxianxian.demo + 1.0-SNAPSHOT + + 4.0.0 + + core + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + \ No newline at end of file diff --git a/core/src/main/java/com/duanledexianxianxian/core/SpringWebApplication.java b/core/src/main/java/com/duanledexianxianxian/core/SpringWebApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..382f67eea1c11089e20b66f5893e2290b742295c --- /dev/null +++ b/core/src/main/java/com/duanledexianxianxian/core/SpringWebApplication.java @@ -0,0 +1,26 @@ +package com.duanledexianxianxian.core; + + +import com.duanledexianxianxian.core.config.SystemProperties; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; + +/** + * springboot 应用程序入口 + * @author duanledexianxianxian + */ +@SpringBootApplication +public class SpringWebApplication { + + public static void main(String[] args) { + ApplicationContext applicationContext= (ApplicationContext) SpringApplication.run(SpringWebApplication.class, args); + SystemProperties properties=applicationContext.getBean(SystemProperties.class); + System.out.println("用户的当前工作目录:"+System.getProperty("user.dir")); + // 打印出配置参数 + System.out.println(properties.getName()); + + } + + +} diff --git a/core/src/main/java/com/duanledexianxianxian/core/config/SystemConfiguration.java b/core/src/main/java/com/duanledexianxianxian/core/config/SystemConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..600c458dab2bd0725413f3efdcaf20c483d9f976 --- /dev/null +++ b/core/src/main/java/com/duanledexianxianxian/core/config/SystemConfiguration.java @@ -0,0 +1,11 @@ +package com.duanledexianxianxian.core.config; + +import org.springframework.context.annotation.Configuration; + +/** + * 配置类 + * @author duanledexianxian + */ +@Configuration +public class SystemConfiguration { +} diff --git a/core/src/main/java/com/duanledexianxianxian/core/config/SystemProperties.java b/core/src/main/java/com/duanledexianxianxian/core/config/SystemProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..2026bc2f8cf3a5aaa239d212ef234d36c471efb5 --- /dev/null +++ b/core/src/main/java/com/duanledexianxianxian/core/config/SystemProperties.java @@ -0,0 +1,23 @@ +package com.duanledexianxianxian.core.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 系统配置类 + * @author duanledexianxianxian + */ +@Component +@ConfigurationProperties(prefix = "system") +@Data +public class SystemProperties { + /** + * 名称 + */ + private String name; + /** + * 编码 + */ + private String code; +} diff --git a/core/src/main/resources/application.yml b/core/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..4956d986cb8cbbec8726025d8e67e0b3962fc9b3 --- /dev/null +++ b/core/src/main/resources/application.yml @@ -0,0 +1,5 @@ +server: + port: 8080 + +system: + name: "classpath root config" \ No newline at end of file diff --git a/core/src/main/resources/config/application.yml b/core/src/main/resources/config/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..85845d728b31c72e27f7fb70df272d577a2a2c50 --- /dev/null +++ b/core/src/main/resources/config/application.yml @@ -0,0 +1,5 @@ +server: + port: 8080 + +#system: +# name: "classpath config" \ No newline at end of file diff --git a/demo-parent.iml b/demo-parent.iml index 28baa0dfcea5a22acae5cf32425dc3a6e1bda271..23843132d2b934c09d72f8d185c73f947947b7ce 100644 --- a/demo-parent.iml +++ b/demo-parent.iml @@ -59,8 +59,6 @@ - - diff --git a/pom.xml b/pom.xml index 06796d7116d8c9d57272c420f0e7fccf4a667933..f9ecdfea82a80526a8c6387a549e99d44b1b98b4 100644 --- a/pom.xml +++ b/pom.xml @@ -9,8 +9,7 @@ pom 1.0-SNAPSHOT - kafka - menu + core