spring-properties Questions
6
Solved
I have created a Spring Boot app which uses a legacy library. This legacy library defines a number of Spring Beans in XML. One of which take in a property value as a constructor argument:
<bean...
Metacarpus asked 12/5, 2016 at 15:57
15
Solved
I've had this working in some other project before, I am just re-doing the same thing but for some reason it's not working. The Spring @Value is not reading from property file, but instead it's tak...
Emad asked 10/4, 2013 at 22:26
4
Solved
Enum
public enum Property {
A,
AB,
ABC;
}
Field
@Value("${custom.property}")
protected Property property;
application.properties (lower case)
custom.property=abc
When I'm running applic...
Secession asked 22/2, 2016 at 23:10
2
Solved
I have a list of values in one property in application.properties file:
my-property=abc,def,ghi
And I load it in my @ConfigurationProperties class:
@Configuration
@ConfigurationProperties
publi...
Orthopedist asked 15/6, 2020 at 17:25
4
Solved
Given an application.properties file:
myProperties.map.key1=value1
myProperties.map.key2=value2
myProperties.map.key with space=value3
And the properties class:
@ConfigurationProperties
public ...
Lenity asked 20/11, 2019 at 9:24
1
What is exact difference between spring.profiles.active and spring.config.activate.on-profile?
"WARN","msg":"Property 'spring.profiles' imported from location 'class path...
Digiacomo asked 21/7, 2022 at 8:8
1
Solved
Spring properties can be bound from environment variables: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.re...
Sanferd asked 8/9, 2022 at 8:31
6
Solved
I want to use the @Value annotation to inject a Double property such as:
@Service
public class MyService {
@Value("${item.priceFactor}")
private Double priceFactor = 0.1;
// ...
and using Sp...
Flocculent asked 11/3, 2017 at 8:29
3
Solved
According to the spring docs, string property values such as 10s will be properly converted into a java.time.Duration.
Indeed this works for me with the main application properties. But it fails in...
Parenthesis asked 27/5, 2021 at 13:15
17
Solved
I want to have a list of values in a .properties file, i.e.:
my.list.of.strings=ABC,CDE,EFG
And to load it in my class directly, i.e.:
@Value("${my.list.of.strings}")
private List<Str...
Fibroin asked 25/9, 2012 at 4:19
0
I'm using spring-boot-starter-parent version 2.4.4.
I'm experimenting with validation on Typed Configuration using @ConstructorBinding and without.
Here's a Typed Config that gets validated and cor...
Triplicity asked 22/3, 2021 at 8:45
3
Solved
I have the following property annotated with @Value. I have a default value defined using the default separator of ':"
@Value("${prop.url:http://myurl.com}")
Is there a way to escape the ':' in ...
Entomologize asked 29/7, 2015 at 21:17
8
Solved
I am working on a Spring Boot application. I need to parse an XML file (countries.xml) on start. The problem is that I do not understand where to put it so that I could access it.
My folders struc...
Neibart asked 2/4, 2016 at 9:52
2
Solved
I have a requirement of accessing application.properties file outside the project location. I am able to achieve the same using following :
@Component
@PropertySources({
@PropertySource(value = "...
Ila asked 4/7, 2019 at 13:3
4
I'm using Spring Boot application. In some @Component class @Value fields are loaded, instead on other classes they are always null.
Seems that @Value(s) are loaded after my @Bean/@Component are c...
Edra asked 20/2, 2015 at 18:45
4
Solved
I have property file application-dev.yml with content:
spring.profiles: dev
config.some.value:
- ELEMENT1
- ELEMENT2
and another application-staging.yml with content:
spring.profiles: staging
...
Chinchilla asked 25/1, 2019 at 13:50
1
Solved
I would create some compilation profiles like these:
profile name: dev
profile name: test
profile name: production
In src/main/resources I have 3 folders:
dev/file.properties
test/file.prope...
Getter asked 5/2, 2018 at 9:13
3
Solved
Is there a way we can lookup file resources using relative path in application.properties file in Spring boot application as specified below
spring.datasource.url=jdbc:hsqldb:file:${project.basedi...
Usance asked 29/4, 2016 at 14:6
1
I want to be able to read the active profiles from a property file so that different environments (dev,prod etc) can be configured with different profiles in a Spring MVC based web application. I k...
Obit asked 12/8, 2015 at 22:58
1
Solved
I am configuring my Spring Boot application with an application.yml file:
foo:
bar: foobar
foolist:
- bar: foobar1
baz: foobaz1
- bar: foobar1
baz: foobaz1
I can easily set the foo.bar value ...
Conjunctive asked 30/1, 2017 at 15:17
2
Solved
I have a application.properites file with the following:
xxx.xxx = sandbox
xxx.sandbox = 123
xxx.production = 456
I would like to map to a string value 123 in case xxx.xxx == sandbox and 456 in ...
Disaccharide asked 10/5, 2016 at 15:57
1
© 2022 - 2024 — McMap. All rights reserved.