java - Guice 私有模块与匹配器绑定
问题描述
我有一个私有的 Guice 模块,我想将它应用于某些类。
这是通过以下方式完成的:
// Inside module code
bind(SomeClass.class)
expose(SomeClass.class)
是否可以使用匹配器进行通用操作?类似于 bindInterceptor?
就像是:
bind(any(), annotatedWith(SomeAnnotation.class));
expose(any(), annotatedWith(SomeAnnotation.class))
解决方案
推荐阅读
- java - Spring boot 不运行,但服务 UTest 运行良好
- python - 如何在 Python 中正确创建和写入文件
- sql - 正确“加入”两个交叉应用
- javascript - ReactJS:使用反应路由器 dom 转到 HTML 中的锚链接
- python-3.x - Python gcloud api 客户端:如何获取实例价格、正常运行时间和创建特定实例的用户名
- docker - 如何更改 docker 容器中的时区?
- css - 为什么以 em 为单位的高度有时大于适当的文本行数乘以它们的行高?
- ruby-on-rails - Searchkick 建议支持 3 个字符的单词
- azure-devops - 使用来自外部存储库的 ARM 模板
- python - 从 spacy.matcher 导入 Matcher 时出错