Implementing Custom Injection Provider, deploy error

classic Classic list List threaded Threaded
1 message Options
nnn
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Implementing Custom Injection Provider, deploy error

nnn
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
Loading...