Spring module could not load properties

25 Views Asked by At

I have multi modules app whera I wrote some library. I have properties there, and it comes from parent-app. My library service looks like that:

@Slf4j
@Service
public class SmsMessageService {

    @Value("${smsservice.oauth-token}")
    private String OAUTH_TOKEN;
    @Value("${smsservice.proxy-address:https://api.smsapi.pl/}")
    private String PROXY_ADDRESS;
    }

Parent-app bootstraps properties from config-server and bootstrap file is just:

spring:
  application:
    name: parent-app
  profiles:
    active: ${SPRING_PROFILES_ACTIVE:dev}
  cloud:
    config:
      uri: ${SPRING_CONFIG_URI:http://localhost:8888}
      fail-fast: true

I add my child library to parent app like this:

<dependency>
            <groupId>child-lib</groupId>
            <artifactId>child-lib</artifactId>
        </dependency>

And everything looks nice, dependency is injected but when i try to use it, it appears I do not have my properties, Spring could not find it. I tried to add @RefreshScope, @PropertySource, nothing works Please, help me :)

0

There are 0 best solutions below