Spring-Boot: How do I reference application.properties in an @ImportResource

前端 未结 2 447
盖世英雄少女心
盖世英雄少女心 2021-01-04 10:32

I have an applicationContext.xml file in my Spring Boot application. In this file, it has a property placeholder - ${profile.services.url} - that\'s used to configure the \"

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-04 11:10

    I was able to workaround my issue by configuring my Soap service in JavaConfig instead of XML:

    @Value("${profile.services.url}")
    private String profileServiceUrl;
    
    @Bean
    public ProfileSoapService profileSoapService() {
        final JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();
        jaxWsProxyFactoryBean.setServiceClass(ProfileSoapService.class);
        jaxWsProxyFactoryBean.setAddress(profileServiceUrl);
        jaxWsProxyFactoryBean.getOutInterceptors().add(getSecurityInterceptor());
        return (ProfileSoapService) jaxWsProxyFactoryBean.create();
    }
    
    
    private WSS4JOutInterceptor getSecurityInterceptor() { ... }
    

提交回复
热议问题