Spring uses this technique internally to its JDBC classes to provide PreparedStatement factories.