Liferay hook CDI
我正在为Liferay开发一个服务钩子,我想使用一个外部EJB为我完成业务逻辑。有没有办法将bean注入服务类 这是我的密码:Liferay hook CDI,liferay,hook,cdi,Liferay,Hook,Cdi,我正在为Liferay开发一个服务钩子,我想使用一个外部EJB为我完成业务逻辑。有没有办法将bean注入服务类 这是我的密码: public class MyUserService extends UserServiceWrapper { //I want a bean injected @Inject MyBean myBean; public MyUserService(UserService userService) { super(us
public class MyUserService extends UserServiceWrapper {
//I want a bean injected
@Inject
MyBean myBean;
public MyUserService(UserService userService) {
super(userService);
}
@Override
public User addUserWithWorkflow(/* all kind of parameters */)
throws PortalException, SystemException {
User user = super.addUserWithWorkflow(/* all parameters passes here //);
//do my business logic here
myBean.userRegistered(user);
return user;
}
}
有没有办法做到这一点 如果bean已经加载到AppContext中(使用hook-spring.xml文件),那么可以使用
Object bean = com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate(
"bean id", "class")
这就是你要找的吗