My Spring boot app has this application structure:
create you beans
@Configuration
@PropertySource("classpath:application.properties")
public class ApplicationBeansConfig {
@Autowired
Environment env;
@Bean
public IApplicationBeanService getService(){
return new ApplicationBeansService(env);
}
}
and then in service costructor
@Service
public class ApplicationBeansService implements IApplicationBeanService {
...
public ApplicationBeansService(Environment env){
...
String value = env.getProperty("your.value")
...
}
...
}
don't forget fill your application.properties:
your.value = some-string-value