UCDetector 错误地检测@Autowired EJB Bean 实现类。

发布于 2024-12-26 00:52:24 字数 275 浏览 6 评论 0原文

我正在使用 UCDetector 1.9.0 来检测死代码。

我有一个本地 EJB3 接口,它在 bean 定义中使用,并在另一个业务委托类中按名称自动装配它。EJB3 的实现运行良好,没有任何问题。由于 bean 接口是在 spring 上下文 xml 文件和业务委托类中引用的,因此它错误地将实现 bean 类标记为未使用的代码

在这种情况下有什么设置可以提供帮助吗?

也欢迎对其他工具提出任何建议。目的是检测Spring/AOP项目中未使用的代码

I am using UCDetector 1.9.0 to detect dead code.

I have a local EJB3 interface which is used in the bean definition and autowired it by name in another business delegate class.The implementation of the EJB3 runs fine without any problem. Since the bean interface is referred in the spring context xml file and the business delegate class it is wrongly flagging the implementation bean class as unused code.

Is there any setting that could help in this case?

Any suggestions on other tools are also welcome. The purpose is to detect unused code in Spring / AOP Projects

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

×眷恋的温暖 2025-01-02 00:52:24

使用UCDetector首选项“实现/扩展的类”。

Use UCDetector preferences "Classes implementing/extending".

知你几分 2025-01-02 00:52:24

UC Detector 根本无法做到这一点。尽管它有一些忽略代码的偏好(例如忽略实现特定接口的类或忽略具有特定注释的代码),但它对于 Spring 来说效果不佳。 UC Detector 将完全忽略那些通常不是您想要的类。如果您使用 Spring 自动连接的类,您只想抑制“Class XY 有 0 个引用”警告,但您仍然需要其他警告(例如关于类的可见性)。如果您告诉 UC Detector 忽略它们,您将一无所获。

UC Detector simply cannot do that. Although it has some preferences to ignore code (e.g. to ignore classes implementing a certain interface or to ignore code with a certain annotation), it doesn't work well for Spring. UC Detector will completely ignore those classes which is typically not what you want. If you use classes which will be auto-wired by Spring you only want to suppress the "Class XY has 0 references" warning, but you still want other warning (e.g. about the visibility of the class). If you tell UC Detector to ignore them, you will get nothing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文