Announcement Announcement Module
Collapse
No announcement yet.
Why is setDatSource() method in JdbcDaoSupport final? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why is setDatSource() method in JdbcDaoSupport final?

    Shouldn't this method have been made just public and not final as well? If not final I could do something like this on my DOAs which extends JdbcDoaSupport:
    public class MyDao extends JdbcDaoSupport implements MyDoaIntF{

    @Autowired
    @Qualifier("coolDataSource")
    @Override
    public void setDataSource(DataSource dataSource){
    super.setDataSource(dataSource);
    }
    }

    now I have to do something like this:
    @Autowired
    @Qualifier("coolDataSource")
    public void setMyDataSource(DataSource dataSource){
    super.setDataSource(dataSource);
    }
    which its not entirely cool.
    p.s. I may be a bit pedantic here....

  • #2
    JdbcDaoSupport doesn't give you much added benefit, so you can either simply create a new JdbcTemplate yourself or inject a JdbcTemplate (saves you extending the spring classes). Next to that you could (and IMHO that is the best solution) create a constructor which takes a DataSource you can do anything you like with the @Autowired annotation. (IMHO the setDataSource method shouldn't have been there in the first place, because a Jdbc based dao without a datasource is pretty useless).

    Comment

    Working...
    X