kpacha/ninja-mustache — pull request #2 by sojin (2014-01-13 04:34:10+00:00)
Title: Fix to run mustache in dev mode with non-cached MustacheFactory

Hi,

I've noticed a small issue where ninja-mustache doesn't refresh template in ninja.dev mode without restart.

The reason is, Guice treat ```bind().toProvider(Provider.class).in(Singleton.class)``` and ```@Singleton``` annotation on Provider class differently.

Because of that ```bind(MustacheFactory.class).toProvider(MustacheFactoryProvider.class).in(Singleton.class);``` will NOT cause Guice to call ```get()``` after it's initialized, leaving ```cachedFactory``` reference retained for every subsequent call to get Instance of MustacheFactory.
Which what desired in PROD mode. But in DEV, we should be able to get non-cached factory so as to have mustache-java to compile each time.

The ```@Singleton``` annotation and binding without ```.in(Singleton.class)``` or ```(Scopes.SINGLETON)``` will come handy here.

MustacheFactoryProvider will be initialized as Singleton, but Guice will call ```get()``` on MustacheFactoryProvider every time whenever instance of MustacheFactory is required. So we can decide whether to return cached or non-cached factory from ```get()``` as its already implemented.

Cheers
Sojin