这个问题已经讨论了几次,但我无法找到解决我们问题的解决方案。我们有以下从数据库获取远程网址的HttpInvoker服务:
@Service("exampleService")
public class ExampleHttpInvoker extends HttpInvokerProxyFactoryBean {
@Resource
private DBService service;
@PostConstruct
public void init() throws ConfigurationException {
String url = service.getURL();
this.setServiceUrl(url);
this.setServiceInterface(RemoteInterface.class);
this.setHttpInvokerRequestExecutor(new CommonsHttpInvokerRequestExecutor());
afterPropertiesSet();
}
}可以在两次远程调用之间更改URL。
如何在运行时替换serviceUrl?
我们不能使用Session或Request作用域,因为服务不是Web感知的。
任何帮助都将不胜感激。
致以最好的问候,迈克尔
发布于 2012-04-17 14:44:13
我并不完全清楚如何才能根据http请求获得正确的DBService,所以我想你知道该怎么做。因此,您可以执行以下操作:
DBService并将其放在TLS上。ExampleHttpInvoker上的DBService替换为DBServiceWrapper (您的类),后者从TLS获取正确的DBService并调用正确的TLS。完成请求后,忘记清除筛选器中的TLS。<代码>H212<代码>G213https://stackoverflow.com/questions/10185051
复制相似问题