I have a Snippet class that has an external dependency (e.g. a REST client for some third-party service). Typically, I would inject this via a constructor argument, but since Lift uses reflection to instantiate Snippet classes on request, I'm not sure how best to do this.
1. I want the dependency externalized, so I can instantiate my Snippet class in a test and inject my own mock/stub version for testing.
2. I don't think I can use a constructor argument, since Lift won't be able to instantiate my Snippet class at request time.
Would it be better to have a global object (e.g. `object bootstrap.liftweb.Boot`) with a mutable variable that gets set by the Lift `Boot.boot` procedure? A major downside to this is that the variable becomes an invisible dependency that I have to remember to set before running my test.
Is there any way for Lift to support a Snippet that has a constructor? Or are there any better patterns for this?