use configure method instead of deprecated inject method.

See advice in comments on d71e28d6d3526ff03872f0b5bd26caed24d3692e.