1
|
/**
|
2
|
* Copyright (C) 2021 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.api.config;
|
10
|
|
11
|
import org.springframework.context.annotation.Configuration;
|
12
|
import org.springframework.context.annotation.PropertySource;
|
13
|
import org.springframework.context.annotation.PropertySources;
|
14
|
|
15
|
/**
|
16
|
* Centralizes the application configuration properties for all <code>@Configuration</code> beans.
|
17
|
*
|
18
|
* The default configuration in {@code classpath:/application.properties} can be overwritten
|
19
|
* by {@code file:/${user.home}/.cdmLibrary/application-dev.properties} for development purposes.
|
20
|
* For production environments it is recommended to use system properties instead.
|
21
|
*
|
22
|
* Mimics the spring boot auto-configuration capabilities to some very basic extend. Can be replaced once we are using spring boot.
|
23
|
*
|
24
|
* spring-boot features that are mimicked:
|
25
|
*
|
26
|
* <ul>
|
27
|
* <li><b>application.properties</b>: The property source file <code>application.properties</code> may be placed in
|
28
|
* <code>src/test/resources</code> and <code>src/main/resources</code></li>
|
29
|
* <li><code>${user.home}/.cdmLibrary/application.properties</code>: the default properties can be overwritten by providing
|
30
|
* this properties file. (this is not a spring boot feature, though!)</li>
|
31
|
* </ul>
|
32
|
* @author a.kohlbecker
|
33
|
* @since Sep 15, 2021
|
34
|
*/
|
35
|
@Configuration
|
36
|
@PropertySources({
|
37
|
// classpath:/application.properties as first
|
38
|
@PropertySource("classpath:/application.properties"),
|
39
|
// allows to use ${user.home}/.cdmLibrary/application.properties to override the default settings !!!
|
40
|
@PropertySource(value="file:${user.home}/.cdmLibrary/application.properties", ignoreResourceNotFound = true)
|
41
|
})
|
42
|
public class AppConfigurationPropertiesConfig {
|
43
|
|
44
|
}
|