EJB计划任务访问JSF管理Bean [英] EJB Schedule task with access to JSF Managed Beans

查看:146
本文介绍了EJB计划任务访问JSF管理Bean的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种感觉,我正在混合EJB和JSF托管的bean的职责,但我想要的是一个计划任务EJB( @Singleton 200 200 200 200 200 200 -40 200 200 200 -40 200 200旗号X- 20045 X- 20045 X- 20045 X- 20045 X- 20045 X- 20045 X- 20045 X- 20045 X- / code> bean,根据是否在开发,测试或生产中发送不同的电子邮件。我想安排这个每24小时发送一封电子邮件。实现这个的最好方法是什么?

解决方案

将业务层(EJB)设置为依赖于表示层。反向(Web层取决于业务层)是经过时间考验的最佳实践。



EJB层是为Web层提供服务。您的用例旨在使Web层向EJB层提供服务。而且,海事组织的这一需要也是微不足道的。
我建议您在两层可以访问的应用程序的安全位置内,将 .properties 文件中的所需配置外部化。


I have a feeling I'm mixing EJB and JSF managed bean responsibilities, but what I want is a scheduled task EJB (@Singleton with @Schedule) that has access to my JSF application scoped beans.

Specifically, I have a JSF @ApplicationScoped bean that sends different e-mails depending on if it's in Development, Test, or Production. I want to schedule this to send e-mails every 24 hours. What's the best way to accomplish this?

解决方案

It's bad design to set the business layer (EJB) as dependent on the Presentation layer. The reverse (Web tier depending on Business tier) is the time tested best practice.

The EJB tier is to provide services to the web tier. Your use case seeks to make the web tier provide services to the EJB tier. And the need, IMO is too trivial to make such a compromise. I'd recommend instead that you externalize the desired config in a .properties file within a secure location in your application that both tiers have access to.

这篇关于EJB计划任务访问JSF管理Bean的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆