105 questions
1
vote
1
answer
91
views
Discrepancy between Environment Variables and Spring property source key names mapping when there are underscores in the property key
I noticed some discrepancy between how spring application properties are resolved using the environment variables. The spring configuration documentation on Binding From Environment Variables explains ...
1
vote
1
answer
538
views
How can I use Optional values in spring-boot configuration properties?
Using spring-boot v3.2.5 I've got configuration that deserializes to this class:
@Getter
// Intentionally Validated and not jakarata.validation.Valid because Valid does not trigger
// validation for ...
1
vote
0
answers
83
views
Java Springboot metadata: Reference map key dynamically as value of another property for hints
All of this was tested/tried on springboot 3.3.0.
Consider the following configuration class file:
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.Map;
@...
1
vote
1
answer
1k
views
Cannot register bean definition for bean that is already defined in TestConfiguration
I have a DataJpaTest with testcontainers for testing my database repositories, such as
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@Testcontainers
@...
0
votes
1
answer
347
views
Matching application.yaml file for two specific profiles
Relevant similar (unanswered) question
I am having troubles implementing a simple configuration matrix for multi-tenant multi-environment Spring Boot application.
We have defined two sets of profiles: ...
4
votes
3
answers
1k
views
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 ...
2
votes
1
answer
2k
views
Why does @AutoConfiguration use proxyBeanMethods = false, @AutoConfigureBefore, @AutoConfigureAfter
Spring Boot auto configuration was recently changed with version 2.7 and most of the settings deprecated with version 3.0 (you can find details here). Also, they introduced new annotation for auto ...
1
vote
1
answer
1k
views
spring boot config server production setup for error "You need to configure a uri for the git repository."
I have a Spring Boot Config server that reads some properties from the local resources folder. The foldersetup is this:
resources
config
application-production.properties
application.properties
...
0
votes
1
answer
1k
views
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....
0
votes
2
answers
322
views
Conditionally replace spring boot config yml property
I would like to replace a configuration yml property using a condition based on environment variables:
spring:
datasource:
username:${ENV} == 'PROD' ? ${USER_PROD} : ${USER_TEST}
password: ${...
2
votes
0
answers
2k
views
How to set a deserializer delegate class in java file instead of yml file?
I set kafka consumer deserializers in application.yml like this:
application.yml
kafka:
consumer:
key-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer
...
1
vote
2
answers
1k
views
Cannot override Spring Bean although CondionalOnMissingBean is present
I have this class in a library project:
@ConditionalOnMissingBean(name = "myServiceActivator")
@Component(value = "myServiceActivator")
public class MyServiceActivator {
@...
0
votes
1
answer
471
views
how we can configure spring boot application to store and retrieve java collections like lists and Date object in redis cache?
how we can configure spring boot application to store and retrieve java collections like lists and Date object in redis cache? Can anyone help me on this?
Redis configuration in spring boot to store ...
1
vote
1
answer
526
views
SpringBoot CouchbaseTemplate: findbyId is working But findByQuery not
Can anyone help me to undersand:
In Spring Data Couchbase: spring-data-couchbase : 4.3.0
Couchbase Version: 6.6.2
By using couchbasetemplate
findById(Entity.class).one(id) is working fine, I am able ...
0
votes
2
answers
823
views
@ConfigurationProperties, @Value not Working YET Passing the Tests
I have a strange problem reading configuration, none of solutions I've seen seem to work. Here is my code:
@SpringBootApplication
@EnableConfigurationProperties
public class Application {
...
2
votes
0
answers
1k
views
How do I get a custom configuration value available in @ConditionalOnExpression annotation
I am trying to have specific beans enabled based on the "functionality" for the deployment, such as a rest interface, a message consumer, an indexer, an archiver, and an admin portal. In ...
0
votes
3
answers
2k
views
How to override SpringBoot config external file to classpath file?
I would like override SpringBoot external's some config into classpath file., when I run jar by command line.
classpath -> application-config.yaml (Not application.yaml)
server:
port: 8080
...
0
votes
1
answer
1k
views
How to enable Spring Boot to connect to external API
I'm developing a Spring Boot application behind a Proxy server. Now I need to connect to an external API but I didn't figure out yet what to configure in order to enable the application to connect to ...
0
votes
1
answer
160
views
spring set Profile from external properties file
I am setting my database properties from an external file and am trying to do the same for the active profile, but am not having any luck.
In app.properties if tried: spring.config.location= C:\\run\\...
0
votes
2
answers
900
views
Springboot Intellij yaml configuration autocomplete with lists
I'm unable to get lists to autocomplete when writing configuration files. Standard objects work as expected.
I've configured both classes as properties:
@SpringBootApplication
@...
2
votes
1
answer
700
views
Spring Boot Test doesn't load complex configuration properties
I have the following yaml configuration in a Spring Boot application:
document-types:
de_DE:
REPORT: ["Test"]
This is loaded using the following class and works perfectly fine when ...
5
votes
2
answers
2k
views
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?...
0
votes
3
answers
733
views
404 spring controller error if JSON string contains number greater than 10 digits
I'm having a controller which gets json as string in request body as below
@PostMapping("/addUser")
public ResponseEntity<?> addUser (@RequestBody String userJson,HttpServletRequest ...
1
vote
1
answer
3k
views
How to connect Config Client to Config server using Eureka server?
I have Scenario that whenever we use config server with config client we need to put in bootstrap.yaml. suppose my config server on port 9001 so i need to hardcore this value in properties file that ...
3
votes
0
answers
3k
views
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 ...