Reputation: 61
I have a parametrized abstract class with one parametrized constructor:
public abstract class BasicEntidadController<T extends Entidad> implements Serializable {
public BasicEntidadController(EntidadBean<T> entidadSessionBean) {....}
// other methods
}
and a child class extending it:
@SessionScoped
@Named
public class TiendaController extends BasicEntidadController<Tienda> implements Serializable {...}
and WELD reports an error telling me that "BasicEntidadController" is not proxyable....
org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435 Normal scoped bean class org.wgualla.sandbox.entity.BasicEntidadController is not proxyable because it has no no-args constructor - Managed Bean [class org.wgualla.sandbox.tienda.TiendaController] with qualifiers [@Any @Default @Named].
Why WELD is trying to create a proxy of this abstract/no-bean class???
Must I do all classes, in inheritance tree, proxyables if I want to inject/use in EL expresion just the last child in the tree?
Thanks in advance.
Upvotes: 4
Views: 1920
Reputation: 2989
By definition a java bean has "The class must have a public default constructor (with no arguments)."
See http://en.wikipedia.org/wiki/JavaBeans#JavaBeans_API
I would suggest that you change your constructor to
public BasicEntidadController() {....}
// other methods
and then add a setter method
setEntidadSessionBean(EntidadBean<T> entidadSessionBean)
Or even better - read about dependancy injection. You can then use something like
@Autowired
EntidadBean<T> entidadSessionBean;
See http://www.vogella.com/articles/SpringDependencyInjection/
Hope this helps
Upvotes: 2