Questions tagged [spring-boot-configuration]

100 questions
66
votes
7 answers

Externalising Spring Boot properties when deploying to Docker

In my Spring Boot app I want to externalise the properties to run in a Docker container. When first deployed, the properties that are currently in my-server/src/main/resources/application.yml are loaded and used by the application as expected. All…
MeanwhileInHell
  • 6,780
  • 17
  • 57
  • 106
23
votes
3 answers

How to set spring.main.allow-bean-definition-overriding to true in a Spring boot 2.1.0 starter configuration

I maintain a spring-boot-starter that customizes the error attributes returned when, for instance, an unknown endpoint is called. This is done by overriding the org.springframework.boot.web.servlet.error.ErrorAttributes bean. Everything worked fine…
Jean-Marc Astesana
  • 1,242
  • 3
  • 16
  • 24
15
votes
3 answers

How to get Intellij to recognize properties in application.yml

I am trying to get Intellij to recognize my properties using gradle. I have followed the steps here. So this means I have a @ConfigurationProperties annotated class with some properties. I added the spring dependency to process them: dependencies…
14
votes
1 answer

Spring Boot Configuration Processor, Duplicate @ConfigurationProperties definition for prefix

In a Spring Boot application, I want to use @ConfigurationProperties annotation with the same prefix to configure my two data sources depending to the profile. Why is it forbidden by Spring Boot Configuration Processor ? The error reported by gradle…
cmaulini
  • 401
  • 1
  • 5
  • 9
11
votes
3 answers

Spring Cloud Config Server using SSH key for Git and running in Docker

I found many questions and tutorials before finally putting this all together. Wanted to document it so somebody else can save many hours of frustration. I am trying to get a private git repository on BitBucket to work with Spring Boot Config…
10
votes
5 answers

Map yaml to object hashmap in SpringBoot

I am trying to Map the yml file to a HashMap with String Key and PromotionPolicy value in my Spring boot application and using the default spring boot implementation to parse the values, but the PromotionPolicy object only contains the default…
Manjunath
  • 117
  • 1
  • 1
  • 5
9
votes
3 answers

Unresolved Placeholder Validation for Spring Boot Configuration Properties

Given some application configuration with an unresolvable placeholder, like the following application.yml my: thing: ${missing-placeholder}/whatever When I use @Value annotations, the placeholders in the configuration file are validated, so in…
5
votes
2 answers

Backwards compatibility when changing Spring Boot externalized configuration

Is there a recommended way to introduce restructurings/renamings into an externalized configuration while keeping backwards compatibility for consumers still relying on the old configuration structure? For example, given a library used the following…
5
votes
3 answers

How to forward the local port of a SpringBootTest to a test configuration

I am currently struggling with the server port injection of the SpringBootTest instance. I've written a test configuration class where I would like to access this port. Test Configuration class: @Target(AnnotationTarget.CLASS,…
4
votes
1 answer

springboot external configuration - profile specific configuration

According to the SpringBoot documentation, the order of configuration is as: Profile-specific application properties outside of your packaged jar (application-{profile}.properties and YAML variants) Profile-specific application properties packaged…
Panos
  • 7,227
  • 13
  • 60
  • 95
3
votes
1 answer

Spring Boot 2 - @Component loading before @Configuration

I have a Spring Boot Application and two classes that come from different jars that i am using, where one of them is @Component, and the other one is @Configuration. Both of them have @PostConstruct methods and basically here is my use case -> i…
alext
  • 678
  • 1
  • 11
  • 25
3
votes
0 answers

Spring Boot @ConfigurationProperties for nested structure

I have a configuration similar to below spring: source: prop1: ['abc', 'def'] prop2: some-value destination: prop1: some-other-value I am trying to read the above configuration with the below…
java_geek
  • 17,585
  • 30
  • 91
  • 113
3
votes
1 answer

RestClientTest and NoSuchBeanDefinitionException

I m trying to use the @RestClientTest to test a rest client class. It is stated that : It will apply only configuration relevant to rest client tests (Jackson or GSON auto-configuration, and @JsonComponent beans), but not regular @Component…
Orkun
  • 6,998
  • 8
  • 56
  • 103
3
votes
1 answer

Spring Cloud Config Config Server - Synchronization between several instances

Let's say I have started to use the spring-cloud-config-server and get it working (using a git repository in background). So now I will deploy that config-server on a cluster (mesos cluster or AWS cloud etc.) So for reliability etc. I would like to…
khmarbaise
  • 92,914
  • 28
  • 189
  • 235
3
votes
0 answers

Ignored Beans in SpringBootTest Configuration

I have the following structure; Main Config Class; @TestConfiguration @Import({MainApplication.class, ConfigA.class, ConfigB.class}) public class MainTestConfiguration { } And two separate config classes; @TestConfiguration public class ConfigA { …
1
2 3 4 5 6 7