Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个实体,文章,我想编写一个需要使用 web 服务转换字段的侦听器。
实际上,侦听器是按原样添加的,没有任何依赖关系。
我想知道将我的服务添加到构造函数以便能够使用它来转换我的字段是否正确。
如果没有,最好的方法是什么?
在我看来,监听器是一种服务,因此它们可以接收其他服务作为参数。
我有时看到的坏事是尝试在模型层中的实体中注入服务......
所以……去吧!