Hi,
I'm upgrading the tests from 2.4 to 2.5, and some things broke. I'm attempting to test an DI class, bound in a Guice module with a @Named annotation.
The Guice module is loaded in the app's application.conf as a play.modules.enabled module. That doesn't seem to be working anymore : The classes don't get binded in Guice.
The test classes' code :
public class EHCacheCacheTest {
@Inject
@EHCache("games")
Cache cache;
@Inject
Application application;
@Before
public void init() {
final Map<String, Object> configuration = new HashMap<>();
configuration.put("cache.bindCaches", Collections.singletonList("games"));
configuration.put("cache.games.type", "ehcache");
configuration.put("play.modules.enabled", Collections.singletonList("com.bm.common.cache.CacheModule"));
final GuiceApplicationBuilder builder = new GuiceApplicationBuilder().
load(Guiceable.modules(
new play.api.inject.BuiltinModule(),
new play.inject.BuiltInModule()
)).
configure(configuration);
Guice.createInjector(builder.applicationModule()).injectMembers(this);
Helpers.start(application);
cache.clear();
}
}
If I leave out the binding of BuiltInModule(), it can't find Play's classes (which makes sense). It now can't find the bindings for @EHCache, which is defined in com.bm.common.cache.CacheModule
Any idea what I'm missing ? I can't load that module itself, since it needs Environment and Configuration, which I don't seem to have.
Igmar