TFBApplication.java 861 B

123456789101112131415161718192021222324
  1. package hello;
  2. import javax.inject.Singleton;
  3. import javax.persistence.EntityManagerFactory;
  4. import org.glassfish.hk2.utilities.binding.AbstractBinder;
  5. import org.glassfish.jersey.jackson.JacksonFeature;
  6. import org.glassfish.jersey.server.ResourceConfig;
  7. import org.glassfish.jersey.server.mvc.mustache.MustacheMvcFeature;
  8. public class TFBApplication extends ResourceConfig {
  9. public TFBApplication() {
  10. super(ServerHeaderFilter.class, JacksonFeature.class, Jackson2MapperProvider.class,
  11. MustacheMvcFeature.class, PlaintextResource.class, JsonResource.class,
  12. FortunesResource.class, WorldResource.class);
  13. property("jersey.config.server.mvc.caching.mustache", "true");
  14. register(new AbstractBinder() {
  15. @Override
  16. protected void configure() {
  17. bindFactory(EMFactory.class).to(EntityManagerFactory.class).in(Singleton.class);
  18. }
  19. });
  20. }
  21. }