2017-10-31 9 views

답변

2

뭔가에 관계없이, secure.properties 아무것도 오버라이드 (override) 할 수 없습니다, 작동합니다 무엇이 재정의되었습니다.

@Configuration 
public class SecurePropertiesConfig { 

    @Autowired 
    private ConfigurableEnvironment env; 

    @Autowired 
    public void setConfigurableEnvironment(ConfigurableEnvironment env) { 
     try { 
      final Resource resource = new ClassPathResource("secure.properties"); 
      env.getPropertySources().addFirst(new PropertiesPropertySource(resource.getFilename(), PropertiesLoaderUtils.loadProperties(resource))); 
     } catch (Exception ex) { 
      throw new RuntimeException(ex.getMessage(), ex); 
     } 
    } 
}