有没有办法将 Spring 依赖项注入到消息驱动的 EJB 中?豆子:
@MessageDriven( ......)
public class MessageBean implements MessageListener {
@Autowired private someDAO; // <-how to wire a Spring managed bean here?
public void onMessage(Message message) {
TextMessage textMsg = (TextMessage)message;
try { someDAO.persist(message); //handle message, save to DB }
catch(Exception e) {}
}
...........