我试图更新使用依赖注入,在这样一个应用程序,我想每个文档类与"线程安全"的注释(需要的话),既为其他编码器和错误检查器.
如果我有一个服务类,如下:
@ImplementedBy(FooImpl.class) public interface FooSrvc { }
它是相关的实施
class FooImpl implements FooSrvc { }
*我应该使用线程安全注释来记录或注释接口和具体实现吗?只是服务,因为它是公开的,只是实施?*例如两者:
@javax.annotation.concurrent.ThreadSafe @org.checkthread.annotations.ThreadSafe @ImplementedBy(FooImpl.class) public interface FooSrvc { } @javax.annotation.concurrent.ThreadSafe @org.checkthread.annotations.ThreadSafe class FooImpl implements FooSrvc { }
注 - 我使用两个不同的线程安全注释集来使用较旧的并发错误查找器CheckThread(我找不到支持jsr-305注释的文档)和FindBugs.
谢谢.