users@jersey.java.net

[Jersey] Implementing Custom Injection Provider, deploy error

From: nnn <nikita.nn_at_gmail.com>
Date: Tue, 12 Apr 2016 09:57:36 -0700 (MST)

sample code;

@Provider
@Priority(200)
@HtmlMinify
public class HtmlMinifyInterceptor implements WriterInterceptor {
  @Inject private HtmlCompressor compressor;
...


public class HtmlMinifierFactory implements Factory<HtmlCompressor> {
  private HtmlCompressor compressor;

  @Override
  public HtmlCompressor provide() {
    if (null == compressor) compressor = new HtmlCompressor();
    ClosureJavaScriptCompressor jsCompressor = new
ClosureJavaScriptCompressor();
    jsCompressor.setCompilationLevel(CompilationLevel.SIMPLE_OPTIMIZATIONS);
    return compressor;
....

@ApplicationPath("/")
public class MainRsConfig extends ResourceConfig {
  public MainRsConfig() {
..
    register(new AbstractBinder() {
      @Override
      protected void configure() {
       
bindFactory(HtmlMinifierFactory.class).to(HtmlCompressor.class).in(Singleton.class);
      }
    });
..

get error on deploy Caused by:
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied
dependencies for type HtmlCompressor with qualifiers @Default at injection
point [BackedAnnotatedField] Inject private
gds.web.minifiers.HtmlMinifyInterceptor.compressor

https://jersey.java.net/documentation/latest/ioc.html
why ?
thanks



--
View this message in context: http://jersey.576304.n2.nabble.com/Implementing-Custom-Injection-Provider-deploy-error-tp7583687.html
Sent from the Jersey mailing list archive at Nabble.com.