CDI object not proxyable with injected constructor

前端 未结 5 1960
广开言路
广开言路 2021-02-20 01:07

When trying to inject arguments into the constructor of a CDI bean (ApplicationScoped), I\'m encountering the following issue:

Caused by: org.jboss.weld.exceptio         


        
5条回答
  •  独厮守ぢ
    2021-02-20 01:54

    We resolved similar problem splitting class into interface and implementation. In your case something like this:

    public interface Config
    {
      // API here
    }
    
    @ApplicationScoped @Priority(0)
    public class ConfigImpl implements Config
    {
      @Inject
      public ConfigImpl(ConfigLocator configLocator) { ... }
    
      // API implementation here
    }
    

提交回复
热议问题