importresource在新的springboot应用程序中工作,而类似的不在我的公司应用程序中工作

时间:2019-06-14 03:28:48

标签: java spring-boot soap

当我在新的Spring Boot应用程序中正常工作而我的公司应用程序中无效时,我试图从jar文件中加载XML

我试图创建一个新的spring boot应用程序,加载它可以正常工作的XML。我的公司应用程序中还存在其他配置文件。幕后有冲突吗?

下面的工作代码:

@SpringBootApplication
@ImportResource("classpath:/security/usernametoken/client/apply-username-token-security-client.xml")
public class App {

    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
    }

}

以下无效代码:

@Configuration
@PropertySource({"classpath:/envs/${env}/vendors-service.properties"})
@ImportResource("classpath:/security/usernametoken/client/apply-username-token-security-client.xml")
public class WebServiceClientConfig {

@Autowired
ApplicationContextFactory applicationContextFactory;


@Value("${device.service.url}")
private String deviceServiceUrl;

@Value("${bcus.ws.security.client.interceptor}")
private String securityInterceptor;

@Bean(name = "marshaller")
public Jaxb2Marshaller marshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("com.barclaycardus.svc.device.v1.request");
    return marshaller;
}

@Bean(name = "deviceService")
public DeviceServiceImpl deviceService(Jaxb2Marshaller marshaller) {
    DeviceServiceImpl deviceService = new DeviceServiceImpl();
    deviceService.setDefaultUri(deviceServiceUrl);
    deviceService.setMarshaller(marshaller);
    deviceService.setUnmarshaller(marshaller);
    List<ClientInterceptor> interceptors = new ArrayList<>();

   Object test =  applicationContextFactory.getBean(securityInterceptor);

   interceptors.add((ClientInterceptor) applicationContextFactory.getBean(securityInterceptor));

    deviceService.setInterceptors(new ClientInterceptor[] {(ClientInterceptor) interceptors});
    return deviceService;
}

任何人都可以让我知道解决此问题,非常感谢

0 个答案:

没有答案