Issue
Below is my yml file in spring boot app
stack:
apiContext: data-service
domainOwner: trata
domainContext: Madata-service
#cluster:
# servicePort: 12000
#gossipPort: 13000
#seedName: seed-service
# seeds:
# - localhost:14000
cluster:
servicePort: 21000
gossipPort: 15000
# seedName: seed-service
seeds:
- localhost:13000
providers:
com.cloudimpl.out.collection.CollectionProvider:
- name: MemCollection
impl: com.cloudimpl.outstack.collection.MemCollectionProvider
status: active
- name: com.cloudimpl.outstack.collection.CollectionProvider
impl: com.cloudimpl.outstack.collection.AwsCollectionProvider
# status: active
configs:
endpoint: http://localhost:1234
leaderTable: LeaderTable
com.cloudimpl.outstack.runtime.EventRepositoryFactory:
- name: MemRepositoryFactory
impl: com.cloudimpl.outstack.runtime.repo.MemEventRepositoryFactory
- name: PostgresRepositoryFactory
impl: com.cloudimpl.outstack.spring.repo.PostgresRepositoryFactory
status: active
configs:
jdbcUrl: jdbc:postgresql://localhost:5432/test
username: postgres
password: QazWsx@1234
defaultTable: masterdataService
#UserTable: userTable
server:
port: 9096
spring:
main:
web-application-type: reactive
below value access is working file
@Value("${outstack.domainOwner}")
private String abc;
but when I try to access in below way it gives an error.
@Value("${outstack.providers.com.cloudimpl.outstack.runtime.EventRepositoryFactory.name}")
private String abc;
I checked it gives error only when add "com.cloudimpl.outstack.runtime.EventRepositoryFactory" this part.
How can I solve this??
Solution
It doesn't work so. You have list with values under "outstack.providers.com.cloudimpl.outstack.runtime.EventRepositoryFactory". It means you can add variable like so:
@Value("${outstack.providers.com.cloudimpl.outstack.runtime.EventRepositoryFactory}")
private List<ParamWrapper> abc;
class ParamWrapper {
private String name;
private String impl;
....
getters and setters
}
And then check your params in this list.
Answered By - Aleks D
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)