In my webproject using tomee, openejb and jackson (among a few other things like hibernate, most important dependencies are listed below) I've got a problem that I just can't fix.
Having a structure as follows:
public abstract class AbstractCrud<E extends AbstractEntity>{
[...]
public abstract ResultWrapper<E> create (E entity);
[...]
}
@Path("/path")
@Consumes("application/json")
@Produces("application/json")
public class ImplementingClass extends AbstractCrud<ImplementingEntity>{
@PUT
@Override
public ResultWrapper<ImplementingEntity> create(final ImplementingEntity entity){
//Some Code
}
}
I get this warning: Both package.ImplementingClass#create and package.ImplementingClass#create are equal candidates for handling the current request which can lead to unpredictable results
Followed by this exception:
Cannot construct instance of `package.AbstractEntity` (no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
at [...]
My best guess is that the annotation scanner doesn't filter for bridge methods and thus the method using the abstract class is used which (of course) can't be instantiated. I have searched on how to exclude methods from the scanner (or complete classes) but haven't found anything.
So my question is: can I exclude classes or methods from the scanner, if not, what else can I do to prevent this from happening?
Dependencies (Using Java 8):
- jackson-jaxrs-json-provider: 2.9.0
- hibernate-core: 5.2.10.Final
- javaee-api: 7.0
- cdi-api: 2.0
- openejb-core: 7.0.3
- openejb-cxf-rs: 7.0.3
- cxf-rt-frontend-jaxrs: 3.1.12
- tomee: 7.0.3
- asm5-shaded (referenced via 3rd party)
- about 20 more...
All of those should be the newest versions.