0
我使用的是Guice 4,我有一個類,我想在http會話級別作用域,所以我用@SessionScoped對它進行了裝飾。問題是,當我單元測試這個類時,我得到以下異常。我不知道我應該如何在我的測試中效仿。單元測試SessionScoped類
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) No scope is bound to com.google.inject.servlet.SessionScoped.
at org.abc.collab.repo.SessionedUOW.class(SessionedUOW.java:12)
at org.abc.business.BusinessModule.configure(BusinessModule.java:18)
發佈您的測試示例,必要的最低限度,包括您的guice測試模塊。 – sargue