Quantcast
Channel: User Jonathan - Stack Overflow
Viewing all articles
Browse latest Browse all 40

Answer by Jonathan for Spring dependency injection generic service class

$
0
0

Having a deep hierarchy you'll need to use something like TypeTools (which I authored):

class DeviceDao extends BaseDao<Device> {}Class<?> entityType = TypeResolver.resolveRawArgument(IBaseDao.clas, DeviceDao.class);assert entityType == Device.class;

Note: As always, type arguments can only be resolved at runtime if they're captured in a type definition. So subclassing BaseDao is necessary.


Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>