Announcement Announcement Module
Collapse
No announcement yet.
How to autowire Class object via constructor injection? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to autowire Class object via constructor injection?

    Hello!

    I have base class with constructor that needs Class object
    Code:
    public GenericDaoHibernate(Class<? extends T> entityClass) {
    		this.entityClass = entityClass;
    	}
    In subclass I need to call this constructor to provide Class object:
    Code:
    @Autowired
    	public JuniorUserDaoHibernate(Class<T> juniorUserClass) {
    		super(juniorUserClass);
    		this.userClass = juniorUserClass;
    	}
    Here super(juniorUserClass); calls constructor of GenericDaoHibernate. I need spring to instantiate
    JuniorUserDaoHibernate and autowire somehow Class object that represents class of entity.
    How to tell spring autowire needed Class object via constrcutor injection?

    Thank you!
Working...
X