Структура проекта:
Код: Выделить всё
|-- Dockerfile
|-- build.gradle
|-- modules
| |-- application
| | |-- build.gradle
| | `-- src
| | `-- main
| | |-- java
| | | `-- org
| | | `-- example
| | | |-- CoreApplication.java
| | `-- resources
| | |-- application-beta.properties
| | |-- application-dev.properties
| | |-- application-local.properties
| | |-- application-prod.properties
| | |-- application-test.properties
| | `-- application.properties
| |-- config-management
| | |-- build.gradle
| | `-- src
| | `-- main
| | |-- java
| | | `-- org
| | | `-- example
| | | `-- controller
| | | `-- TestController.java
| | `-- resources
| | |-- application-beta.properties
| | |-- application-dev.properties
| | |-- application-local.properties
| | |-- application-prod.properties
| | |-- application-test.properties
| | `-- application.properties
`-- settings.gradle
Код: Выделить всё
application.propertiesКод: Выделить всё
config.hello=hello-from-config
Код: Выделить всё
application.propertiesКод: Выделить всё
config.hello=hello-from-application
Код: Выделить всё
TestController.javaКод: Выделить всё
@RestController
public class TestController {
@Value("${config.hello}")
private String hello;
@GetMapping("hello")
public String get() {
return hello;
}
}
Подробнее здесь: https://stackoverflow.com/questions/738 ... pring-boot
Мобильная версия