I'm pretty sure its some kind of configuration error, but i'm not sure where and how to fix it, so maybe someone with more experience can help.
I implemented a kind of BeanRef, that at application start uses Reflections to search all classes in package de.app.appserver.persistence.dao.impl and below, that are annotated with @DAO and saves them to a map with the respective entity class as their key. It mostly works exactly how i want, but for some reason it cant detect my base dao implementation.
Here is my class hierachy for daos:
de.app.appserver.persistence.dao.iface.CommonDao.java
de.app.appserver.persistence.dao.iface.entity.EntityDao.java
de.app.appserver.persistence.dao.impl.GenericBaseDao.java
de.app.appserver.persistence.dao.impl.entity.EntityDaoImpl.java
Interfaces:
public interface CommonDao {
//dao methods
}
public interface EntityDao extends CommonDao {
//dao methods
}
Classes:
@DAO(AbstractPersistentEntity.class)
public class GenericBaseDao implements CommonDao {
//dao method implementations
}
@DAO(Entity.class)
public class EntityDaoImpl extends GenericBaseDao implements CommonDao {
//dao method implementations
}
StaticBeanRef:
public class StaticBeanRef {
public static void registerDaos() {
logger.info("registering daos...");
Reflections ref = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("de.app.appserver.persistence.dao.impl")));
Set<Class<?>> daoClasses = ref.getTypesAnnotatedWith(DAO.class);
//retrieve dao instances via daoClasses and save them
}
}
From my understanding, this should yield the classes "GenericBaseDao.class" and "EntityDaoImpl.class", but it only returns "EntityDaoImpl.class". Its not a huge problem, i can just add "GenericBaseDao.class" manually, but it bugs me that its no working how i want.
Does anyone know why this is happening? I did a little debugging, but its late so didnt get to far. What i found is, the Reflections objects TypedAnnotationsScanner store contains a whole lot of other classes, that arent even part of the configured package path.
Any insight would help my coding ocd ^^
I'm pretty sure its some kind of configuration error, but i'm not sure where and how to fix it, so maybe someone with more experience can help.
I implemented a kind of BeanRef, that at application start uses Reflections to search all classes in package
de.app.appserver.persistence.dao.impland below, that are annotated with@DAOand saves them to a map with the respective entity class as their key. It mostly works exactly how i want, but for some reason it cant detect my base dao implementation.Here is my class hierachy for daos:
Interfaces:
Classes:
StaticBeanRef:
From my understanding, this should yield the classes "GenericBaseDao.class" and "EntityDaoImpl.class", but it only returns "EntityDaoImpl.class". Its not a huge problem, i can just add "GenericBaseDao.class" manually, but it bugs me that its no working how i want.
Does anyone know why this is happening? I did a little debugging, but its late so didnt get to far. What i found is, the Reflections objects TypedAnnotationsScanner store contains a whole lot of other classes, that arent even part of the configured package path.
Any insight would help my coding ocd ^^