TFBApplication.java 864 B

12345678910111213141516171819202122232425
  1. package hello;
  2. import javax.inject.Singleton;
  3. import org.glassfish.hk2.utilities.binding.AbstractBinder;
  4. import org.glassfish.jersey.jackson.JacksonFeature;
  5. import org.glassfish.jersey.server.ResourceConfig;
  6. import org.glassfish.jersey.server.mvc.mustache.MustacheMvcFeature;
  7. import org.hibernate.SessionFactory;
  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(SessionFactoryFactory.class).to(SessionFactory.class).in(
  18. Singleton.class);
  19. }
  20. });
  21. }
  22. }