0

I have two issues when I work with springboot 1.5.4, I can not resolve them.

Issue No 1.

I configured the logback-spring.xml in src/main/resources,when spring boot started, two directories will be created, one is started with 'application name', the another one is started with bootstrap..

i was confused why bootstrap log file directory created, spring boot created two log directories, by the way, spring maybe loaded the logback-spring.xml two times when it started.

Issue No 2.

I have many projects, some same configures need to copy to application file in every project, and I want to put some common properties in a common files.

How to refenrence a common config file or include it ?

Is there a usage in spring boot application.yml like below:

spring.xx.inclue: ../common-project/config/common.yml

Thanks.

Raw
  • 615
  • 1
  • 7
  • 22
  • The first issue is resolved, spring.application.name should be in bootstrap file, because logback-spring.xml referenced this name.. – Raw Jul 26 '17 at 09:56
  • Please, see the following https://stackoverflow.com/questions/528281/how-can-i-include-an-yaml-file-inside-another – Eugene Ustimenko Jul 26 '17 at 10:08
  • @EugeneUstimenko can you tell me the usage in spring boot? thanks. – Raw Jul 27 '17 at 05:17
  • If you have alone project with microservice arch and use maven/gradle/ant to build whole, you can use `build-properties` plugin. But if these projects are divided you can use `@PropertySource` for separate java class to include file by absolute path. – Eugene Ustimenko Jul 27 '17 at 06:05

1 Answers1

0

About the spring.application.name being in bootstrap file, isn't really necessary. you can declare a spring property:

<springProperty name="applicationName" source="spring.application.name" defaultValue="UNKNOWN_APP"/>

I think this makes easier the idea of getting a common.yml that is not really needed.

But if for some reason you want that, you can use property feature:

<property resource="commons.yml" />