Adding a Pre-constructed Bean to a Spring Application Context

后端 未结 6 1916
醉话见心
醉话见心 2020-12-24 02:24

I am writing a class that implements the following method:

public void run(javax.sql.DataSource dataSource);

Within this method, I wish to

6条回答
  •  情歌与酒
    2020-12-24 03:08

    If you create an object by calling "new", it's not under the control of the Spring factory.

    Why not have Spring inject the DataSource into the object instead of passing it into run()?

提交回复
热议问题