diff --git a/axzo-common-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/axzo-common-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 0000000..61a1404 --- /dev/null +++ b/axzo-common-boot/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,53 @@ +{ + "groups": [ + { + "sourceType": "cn.axzo.framework.boot.env.configoverride.ConfigOverrideProperties", + "name": "spring.config.override", + "type": "cn.axzo.framework.boot.env.configoverride.ConfigOverrideProperties" + } + ], + "properties": [ + { + "sourceType": "cn.axzo.framework.boot.env.configoverride.ConfigOverrideProperties", + "name": "enabled", + "type": "java.lang.Boolean", + "defaultValue": false + }, + { + "sourceType": "cn.axzo.framework.boot.env.configoverride.ConfigOverrideProperties", + "name": "props-file", + "type": "java.lang.String", + "defaultValue": "override" + }, + { + "name": "system.properties.fetch-local-ip", + "type": "java.lang.Boolean", + "defaultValue": true + }, + { + "name": "system.properties.fetch-local-ip-timeout-seconds", + "type": "java.lang.Integer", + "defaultValue": 2 + }, + { + "name": "spring.application.id", + "type": "java.lang.String", + "defaultValue": "000" + }, + { + "name": "spring.profiles.default", + "type": "java.lang.String", + "defaultValue": "local" + }, + { + "name": "spring.profiles.check-active", + "type": "java.lang.Boolean", + "defaultValue": true + }, + { + "name": "logging.file-enabled", + "type": "java.lang.Boolean", + "defaultValue": true + } + ] +} \ No newline at end of file diff --git a/axzo-common-boot/src/main/resources/META-INF/spring.factories b/axzo-common-boot/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..a1f1882 --- /dev/null +++ b/axzo-common-boot/src/main/resources/META-INF/spring.factories @@ -0,0 +1,18 @@ +# PropertySource Loaders +org.springframework.boot.env.PropertySourceLoader=\ +cn.axzo.framework.boot.env.UnicodePropertiesPropertySourceLoader + +# Application Listeners +org.springframework.context.ApplicationListener=\ +cn.axzo.framework.boot.logging.log4j2.Log4j2MDCSetupListener,\ +cn.axzo.framework.boot.logging.log4j2.Log4j2MDCListener,\ +cn.axzo.framework.boot.system.SystemPropertiesListener,\ +cn.axzo.framework.boot.DefaultProfileOverrideListener,\ +cn.axzo.framework.boot.env.CheckActiveProfilesListener,\ +cn.axzo.framework.boot.script.ScriptListener + +# Environment Post Processors +org.springframework.boot.env.EnvironmentPostProcessor=\ +cn.axzo.framework.boot.env.configoverride.ConfigOverrideEnvironmentPostProcessor,\ +cn.axzo.framework.boot.env.devtools.DevToolsPropertyPostProcessor,\ +cn.axzo.framework.boot.DynamicBannerEnvironmentPostProcessor \ No newline at end of file diff --git a/axzo-common-boot/src/main/resources/log4j2.StatusLogger.properties b/axzo-common-boot/src/main/resources/log4j2.StatusLogger.properties new file mode 100644 index 0000000..1706f14 --- /dev/null +++ b/axzo-common-boot/src/main/resources/log4j2.StatusLogger.properties @@ -0,0 +1,17 @@ +# 关闭log4j2在加载配置文件期间,由于找不到配置文件而打印的错误日志 +# spring-boot已经封装了加载配置文件的过程,log4j2无需再关心加载期, +# 为了避免两个框架都去加载配置文件,文件名最好不要用标准的命名,官方建议加上-spring, +# 这样一来,log4j2就找不到配置文件了,默认会打一条ERROR日志,所以要关闭此期间的StatusLogger + +# log4j2官网描述 +# Before a configuration is found, +# status logger level can be controlled with system property:org.apache.logging.log4j.simplelog.StatusLogger.level. +# After a configuration is found, +# status logger level can be controlled in the configuration file with the "status" attribute, +# for example: . + +# SpringBoot官网描述 +# When possible we recommend that you use the -spring variants for your logging configuration. +# For example log4j2-spring.xml rather than log4j2.xml. +# If you use standard configuration locations, Spring cannot completely control http initialization. +org.apache.logging.log4j.simplelog.StatusLogger.level=off \ No newline at end of file diff --git a/axzo-common-boot/src/main/resources/log4j2.component.properties b/axzo-common-boot/src/main/resources/log4j2.component.properties new file mode 100644 index 0000000..463ac4e --- /dev/null +++ b/axzo-common-boot/src/main/resources/log4j2.component.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#log4j的shutdownHook会托管给spring +log4j.shutdownHookEnabled=false \ No newline at end of file