java - Inject the values with singleton scope using class name -
i new spring. class diagram this
public abstract class cache{     refreshcache() {       clearcache();       createcache();     }     clearcache();     createcache();     getname(); }  @component @scope("singleton") @qualifier("category") class category extends cache implements icategory{}  @component @scope("singleton") @qualifier("attr") class attr extends cache implements iattr{}  @component @scope("singleton") @qualifier("country") class country extends cache implements icountry{}   by default scope of spring beans singleton. want create cache management service. reflection classes extends cache class cache singleton scope if instantiate them "new" getting new object other different object , other class inject following.
class {   @inject   country c }  class b {   @inject   attr attr }   every injection using same cache if create "new" refresh not reflect them. 
p.s. - main goal create class know classes extending cache class , given name (getname() function cache class) refresh respective cache. if spring have functionality enough.
"the main goal create class know classes extending cache class , given name (getname() function cache class)"
just create collection @autowired or @inject
@autowired list<cache>      
Comments
Post a Comment