java应用程序上下文获取空值
这是一段代码:-
ApplicationContext工厂=新注释配置ApplicationContext( 通用域名格式。南纬。财政司司长。配置。服务JaxWsServiceConfiguration。类
com。南纬。财政司司长。服务。春天ServiceLocator配置。类)
这里工厂给出的是“空”值
JaxWsServiceConfiguration。爪哇
//First class , We have SAOP based in this project.
@Configuration
@ComponentScan(basePackages="fs.config")
public class JaxWsServiceConfiguration{
private static final int SHORT_TIMEOUT = 60000;
private static final int LONG_TIMEOUT = 5000;
private static final String GIFT_VOUCHER_NAMESPACE = "http://giftvoucher";
private static final String LOYALTY_TRANSACTION_NAMESPACE =
"http://www.centric.eu/2010/10/";
/**
* @return a port factory for creating ports to the gift voucher web service
*/
@Bean//(lazy = Lazy.TRUE)
public WcfJaxWsPortFactory<GiftvoucherManagementService>
giftVoucherWebServiceFactory() {
WcfJaxWsPortFactory<GiftvoucherManagementService> factory = new
WcfJaxWsPortFactory<GiftvoucherManagementService>();
factory.setPortName(new QName(GIFT_VOUCHER_NAMESPACE,
"giftvoucherManagementServiceFederatedEndpoint"));
factory.setServiceNamespace(GIFT_VOUCHER_NAMESPACE);
factory.setWsdlDocumentLocation("classpath:META-
INF/wsdl/GiftvoucherManagementService.wsdl");
factory.setServiceEndpointInterface(GiftvoucherManagementService.class);
factory.setConnectionTimeout(LONG_TIMEOUT);
factory.setReadTimeout(LONG_TIMEOUT);
factory.setEndpointURL("http://obp/obp/Process/GiftvoucherManagementService.svc");
return factory;
}
/**
* @return a gift voucher web service client port
*/
//return a gift voucher web service client port
@Bean
public GiftVoucherService giftVoucherService() {
JaxWsGiftVoucherService service = new JaxWsGiftVoucherService();
service.setService(giftVoucherWebServiceFactory().createSecuredPort());
return service;
}
/**
* @return a port factory creating ports to the loyalty web service
*/
@Bean//(lazy = Lazy.TRUE)
public WcfJaxWsPortFactory<LoyaltyTransactionService> loyaltyWebServiceFactory() {
WcfJaxWsPortFactory<LoyaltyTransactionService> factory = new
WcfJaxWsPortFactory<LoyaltyTransactionService>();
factory.setPortName(new QName(LOYALTY_TRANSACTION_NAMESPACE,
"loyaltyTransactionServiceFederatedEndpoint"));
factory.setServiceName(new QName(LOYALTY_TRANSACTION_NAMESPACE,
"LoyaltyTransactionService"));
factory.setWsdlDocumentLocation("classpath:META-
INF/wsdl/LoyaltyTransactionService.wsdl");
factory.setServiceEndpointInterface(LoyaltyTransactionService.class);
factory.setConnectionTimeout(SHORT_TIMEOUT);
factory.setReadTimeout(SHORT_TIMEOUT);
factory.setEndpointURL("http://obp/obp/Process/LoyaltyTransactionService.svc/federated");
return factory;
}
/**
* @return a loyalty web service client port
*/
@Bean//(lazy = Lazy.TRUE)
public LoyaltyTransactionService loyaltyService() {
return loyaltyWebServiceFactory().createSecuredPort();
}
/**
* @return a port factory creating infrastructure service ports
*/
@Bean//(lazy = Lazy.TRUE)
public WcfJaxWsPortFactory<IInfrastructureManagementService>
infrastructureServiceFactory() {
WcfJaxWsPortFactory<IInfrastructureManagementService> factory = new
WcfJaxWsPortFactory<IInfrastructureManagementService>();
factory.setPortName(new QName("http://tempuri.org/",
"BasicHttpBinding_IInfrastructureManagementService"));
factory.setServiceName(new QName("http://tempuri.org/",
"InfrastructureManagementService"));
factory.setWsdlDocumentLocation("classpath:META-
INF/wsdl/InfrastructureManagementService.svc.xml.wsdl");
factory.setServiceEndpointInterface(IInfrastructureManagementService.class);
factory.setConnectionTimeout(10000);
factory.setReadTimeout(10000);
factory.setEndpointURL("http://obp/obp/Process/InfrastructureManagementService.svc");
return factory;
}
/**
* @return an infrastructure service client port
*/
@Bean//(lazy = Lazy.TRUE)
public IInfrastructureManagementService infrastructureService() {
WcfJaxWsPortFactory<IInfrastructureManagementService> factory =
infrastructureServiceFactory();
return factory.createPort();
}
}
ServiceLocatorConfiguration.java
------------------------------------
//Second class
@Configuration
@ImportResource(locations = { "classpath:/services/serviceLocatorContext.xml" })
public class ServiceLocatorConfiguration {
}
这两个类用于调用
共 (0) 个答案