Использование сервера Spring Cloud Config без профилей SpringJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Гость
 Использование сервера Spring Cloud Config без профилей Spring

Сообщение Гость »


I am making a Java library with Spring cloud config server support, which provides different ways to get application properties from different sources depending on feature flags (input environment properties). For example, AWS S3 bucket will be searched for property files by an application on startup if a feature flag is enabled.
As for now when I add my library in my application it works fine if I add spring profile "awss3" and I see there is some logic on this profile in EnvironmentRepositoryConfiguration class, but when I remove this profile, it starts trying to instantiate DefaultRepositoryConfiguration and expectedly fails.
I've tried to define my configuration class with awss3 repository bean creation

Код: Выделить всё

@Configuration
@ConditionalOnProperty(name = "aws.s3.enabled", havingValue = "true")
public class S3Configuration {

@Bean
public AwsS3EnvironmentRepository awsS3EnvironmentRepository(AwsS3EnvironmentRepositoryFactory factory,
AwsS3EnvironmentProperties environmentProperties) {
return factory.build(environmentProperties);
}
}
and I was expecting that my configuration class would be scanned earlier so Spring knows bean of type EnvironmentRepository is present and never tries to create a default one, but Spring just checks ConditionalOnMissingBean on DefaultRepositoryConfiguration earlier and context instantiation fails.
I tried to manipulate ordering using annotations like Order and AutoConfigureBefore, and I tried to remove my configuration file from Autoconfiguration. import file in properties so it's not interpreted like autoconfiguration, but it does not help.
My aim is just to escape setting up a profile and depending only on feature flags when using AWS S3 as a config server, maybe someone has a clue how could I achieve this?


Источник: https://stackoverflow.com/questions/781 ... g-profiles
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Spring.cloud.config.server.native.search-locations не работает с заполнителями на сервере Spring Cloud Config
    Anonymous » » в форуме JAVA
    0 Ответы
    58 Просмотры
    Последнее сообщение Anonymous
  • Spring.cloud.config.server.native.search-locations не работает с заполнителями на сервере Spring Cloud Config
    Anonymous » » в форуме JAVA
    0 Ответы
    20 Просмотры
    Последнее сообщение Anonymous
  • Соединение Docker Cloud Cloud Cloud Cloud
    Anonymous » » в форуме JAVA
    0 Ответы
    85 Просмотры
    Последнее сообщение Anonymous
  • Соединение Docker Cloud Cloud Cloud Cloud
    Anonymous » » в форуме JAVA
    0 Ответы
    69 Просмотры
    Последнее сообщение Anonymous
  • Не удалось найти org.springframework.cloud:spring-cloud-starter-config:
    Anonymous » » в форуме JAVA
    0 Ответы
    4 Просмотры
    Последнее сообщение Anonymous

Вернуться в «JAVA»