i have 4 project a-service b-service c-service and the client-service.
This client-service is added as a dependency these three service. Client-service uses OAuth2RestTemplate and sets some credentials information. But in this structure; all the services uses same credentials. Now, i want to send service-specific property value from a, b and c services to client-service.
RestTemplateBuilder is a class from client-service.
@Component
public class RestTemplateBuilder {
@Value("${client.prefix}")
private String clientPrefix;
.
.
.
}
and i defined client.prefix in application.properties file in a-service.
client.prefix=aservice
but client-service can not read property value from application.properties in a-service. clientPrefix value is returning null.
i tried some solutions from stackoverflow but does not work for me. the solution i tried is like below;
so, how to read properties from dependency project classes in spring boot?