O PropertySourcesPlaceholderConfigurer não está se registrando no Environment em um projeto SpringBoot

Estou movendo um projeto de trabalho do uso de argumentos de linha de comando do SpringBoot para a leitura de propriedades de um arquivo. Aqui estão as partes envolvidas do@Configuration classe:

@Configuration
class RemoteCommunication {

    @Inject
    StandardServletEnvironment env


    @Bean
    static PropertySourcesPlaceholderConfigurer placeholderConfigurer () {
        // VERIFIED this is executing...
        PropertySourcesPlaceholderConfigurer target = new PropertySourcesPlaceholderConfigurer()
        // VERIFIED this files exists, is readable, is a valid properties file
        target.setLocation (new FileSystemResource ('/Users/me/Desktop/mess.properties'))
        // A Debugger does NOT show this property source in the inject Environment
        target
    }


    @Bean  // There are many of these for different services, only one shown here.
    MedicalSorIdService medicalSorIdService () {
        serviceInstantiator (MedicalSorIdService_EpicSoap, 'uri.sor.id.lookup.internal')
    }


    // HELPER METHODS...


    private <T> T serviceInstantiator (final Class<T> classToInstantiate, final String propertyKeyPrimary) {
        def value = retrieveSpringPropertyFromConfigurationParameter (propertyKeyPrimary)
        classToInstantiate.newInstance (value)
    }


    private def retrieveSpringPropertyFromConfigurationParameter (String propertyKeyPrimary) {
        // PROBLEM: the property is not found in the Environment
        def value = env.getProperty (propertyKeyPrimary, '')
        if (value.isEmpty ()) throw new IllegalStateException ('Missing configuration parameter: ' + "\"$propertyKeyPrimary\"")
        value
    }

Usando@Value injetar as propriedadesfaz trabalho, no entanto, eu prefiro trabalhar com oEnvironment diretamente, se possível. Se as configurações não estiverem noEnvironment então não sei exatamente onde@Value está puxando-os de ...

env.getProperty() continua funcionando bem quando passo os argumentos da linha de comando, especificando as propriedades.

Todas as sugestões são bem-vindas!

questionAnswers(4)

yourAnswerToTheQuestion