There’s an idiomatic way of providing library functionality throughout Spring. Modules such as Spring JDBC, AMQP or Web provide templates as beans. Users can have these templates injected into their components, and access the functionality.
Publishing the Query/Response API through static factory methods, may be convenient but it is not the common way. It also hides the capabilities of mock or test dummy setup in the user code, which makes testing harder.
The QueryBuilder
and ResponseBuilder
should both be made available through
the means of bean injection. The static factory methods are removed.
The beans shall be available as mockable types, to better support testing.