如何将 EJB 注入 XmlAdapters?
这个想法是我想通过rest API获取ID列表并将这个ID数组转换为实体对象的对象列表。例如:
public class Post {
List<Category> categories;
...
}
public class AdaptedPost {
List<Long> categories;
...
}
public class PostAdapter extends XmlAdapter<AdaptedPost, Post> {
@EJB
CategoryFacade categoryFacade;
@Override
public Post unmarshal(final AdaptedPost adaptedPost) throws Exception {
// Use facade class to retrieve category object from ID
}
...
}