【发布时间】:2015-02-16 06:14:56
【问题描述】:
我认为这是一个非常基本的问题,但我还没有找到解决方案。 我将如何“输出”一个对象,我以后希望将其作为要注入的对象。
假设我们有 ServiceA,它创建了一个对象
@Stateless
public class ServiceA {
public void createObject() {
MyObject myObject = callSomeService();
---> now put myObject into the session
}
}
另一个服务 B 应该可以使用这个对象:
@Stateless
public class ServiceB {
//should be available here
@Inject
private MyObject myObject
}
我该怎么做? 感谢您的帮助!
【问题讨论】: