Guice 和 JSR-330
JSR-330 在包方面指定了某些命名约定,例如:
javax.inject.Inject
javax.inject.Scope
Guice 是 JSR-330 的参考实现。但是,在使用它时,您会发现它不符合规范。例如:
com.google.inject.Inject
com.google.inject.Scope
到目前为止,在我见过的任何参考实现中都没有发生这种情况。是什么让 Google Guice 如此特别,以至于作为 RI 他们可以忽略他们正在实施的规范?
JSR-330 specifies certain naming conventions in terms of packages, for example:
javax.inject.Inject
javax.inject.Scope
Guice is the Reference Implementation of JSR-330. However, when using it, you notice that it doesn't follow the spec. For example:
com.google.inject.Inject
com.google.inject.Scope
This doesn't happen in any of the reference implementations I have seen so far. What makes Google Guice so special that being the RI they can just ignore the specification they are implementing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Guice 3 支持 JSR 330 注释。它还支持
com.google
注释,以向后兼容早期版本的 Guice(当 JSR 330 尚不存在时)。Guice 3 supports JSR 330 annotations. It also supports the
com.google
annotations for backwards compatibility with earlier versions of Guice (when JSR 330 didn't exist yet).