[
https://issues.apache.org/jira/browse/DBUTILS-99?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437922#comment-13437922
]
William R. Speirs commented on DBUTILS-99:
------------------------------------------
Maybe this is my mis-understanding of dependency injection. I don't use Guice
and simply inject my dependencies via the constructor, so something like:
{code:borderStyle=solid}
public MyClass(QueryRunnerFactory factory) {
this.factory = factory;
}
{code}
This way I can simply mock up an instance of QueryRunnerFactory in my unit
tests and provide fake results from the DB. Maybe this isn't useful for others?
> Create QueryRunner Factory
> --------------------------
>
> Key: DBUTILS-99
> URL: https://issues.apache.org/jira/browse/DBUTILS-99
> Project: Commons DbUtils
> Issue Type: Improvement
> Affects Versions: 1.5
> Reporter: William R. Speirs
> Assignee: William R. Speirs
> Priority: Minor
>
> Currently there is no good way to use dependency injection with QueryRunners.
> Creating a simple factory class to allow for easy injection (and therefore
> easier unit test creation) should solve this problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira