Questions tagged [spring-boot-configuration]

100 questions
1
vote
2 answers

Spring Boot properties that depend on profile-specific properties

I have a Spring Boot application which should connect to different servers in dev and prod, with many services running on those servers. To this point, I have created the configuration like…
1
vote
2 answers

GSON deserializing null value not working

I am trying to de-serialize the json string. I tried different API's but I didn't find the solution. Here, am trying to deserialize below json and want to read value of each field/element. Example below - String inputJson = "{"phone":null,…
Pand005
  • 1,095
  • 3
  • 23
  • 53
1
vote
1 answer

Spring boot reading configuration yaml hashmap based

is it possible to read the yaml file in Spring boot using the @configurationproperties ? app: X1: key1: value1 key2: value2 X2: key1: value3 key2: value4 X3: key1: value5 key2: value6 X4: key1: value7 key2:…
Rajkumar
  • 11
  • 1
1
vote
0 answers

Spring Boot and External Resource (like keytab) Files

I need to load few external resource files in my Spring Boot Application, something like below... getClass().getClassLoader().getResource("mongoKerberos.Keytab"); After spending sometime, I realized that java command (as shown below) with class…
user3495691
  • 451
  • 1
  • 5
  • 16
1
vote
1 answer

How to check if an spring boot application has a certain annotation in autoconfiguration class

I am creating my own spring boot starter to centralise some common configurations in my projects. I would like to let on of my @Configuration classes be only matched, if my spring boot app is annotated in a certain way like…
1
vote
1 answer

Loading HashMap to a nested configuration bean throws Binding Exception

I was attempting this example given here : https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-typesafe-configuration-properties All worked well except when attempted added another properties to load…
techsavvy
  • 143
  • 3
  • 16
1
vote
0 answers

How to create a shared spring configuration in a shared library

I would like to create a shared library which provides default configuration to all my spring-boot web application clients. So far I was successfully able to create default actuator configuration using this SO answer. However, I'd like to provide…
LIvanov
  • 1,126
  • 12
  • 30
1
vote
2 answers

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration with your test

Should we make seprate test folder or test folder under src? My test class location is: server/test/com/cellpointmombile/mconsole/manualtrigger/ManualTriggerControllerTest.java And I am writing Junit for class ManualTriggerController, and its path…
1
vote
1 answer

Use of configuration properties in @Configuration classes

Is it expected that configuration properties classes should be usable within @Configuration classes. Environment Spring Boot 2.0.2 java version "10.0.1" 2018-04-17 Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10), Java HotSpot(TM) 64-Bit…
David
  • 7,652
  • 21
  • 60
  • 98
1
vote
0 answers

Spring does not load data beans (@Repository) from dependency

Situation I have a modular Spring Boot application, which currently consists of the applicationProject, that includes the first sub module moduleA as dependencies (maven). This allows the applicationProject to be a single java class, which…
1
vote
2 answers

Spring boot common application properties

Spring boot application properties needs to follow convention from https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html when we use any DB like cassandra/mongo. In case if we want to declare our own…
Ayan
  • 515
  • 4
  • 9
  • 20
0
votes
0 answers

How to use the configuration processor with records

I am using spring-boot-configuration-processor to generate a spring-configuration-metadata.json file. When I use a class for my configuration, the description is taken from the javadoc above the field like in this example using…
0
votes
0 answers

How do I access application.yml Spring Properties from the BoostrapRegistryInitializer?

I have the following to initialize a static client... public class Boostrap implements BootstrapRegistryInitializer { @Override public void initialize(BootstrapRegistry registry) { // TODO: Get the username from properties …
JGleason
  • 3,067
  • 6
  • 20
  • 54
0
votes
0 answers

How (Is it worth) to use condition annotations without spring-boot-autoconfigure?

Suppose I am developing a java library such that if it is added to spring boot application, it automatically configures application context. Say, it adds some properties or beans. Thus, I am going to use META-INF/spring.factories file with…
legeyda
  • 86
  • 4
0
votes
1 answer

Enable or disable Spring restful API (endpoint) based on the flag from DB

I have a restful API which has to be enabled or disabled based on the flag value which I would be fetching during application load. But I am unable enable/disable the API using @Conditional Annotation. I can achieve this by @ConditionOnProperty by…