Skip to content

Commit fa8d6ab

Browse files
Peter Amiriclaude
andcommitted
docs(web/blog): use local.di (not top-level var) in from-wirebox-to-wheelsdi services.cfm example
The `config/services.cfm` snippet used a top-level `var di = injector();`. A bare top-level `var` statement compile-errors on Adobe CF (#3063) — `config/services.cfm` is an included template, not a function body, so `var` isn't valid there on Adobe. Lucee/BoxLang tolerate it, but the example as shipped breaks for Adobe readers who copy it. Switch to the cross-engine-safe `local.di` form (matching the DI guide and CLAUDE.md), and update the chained references to `local.di.*`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Peter Amiri <petera@pai.com>
1 parent eb73cb6 commit fa8d6ab

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

web/content/blog/posts/from-wirebox-to-wheelsdi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ PRs [#1883](https://github.com/wheels-dev/wheels/pull/1883) and [#1888](https://
4646

4747
```cfm
4848
// config/services.cfm — in-house DI, familiar surface
49-
var di = injector();
50-
di.map("emailService").to("app.lib.EmailService").asSingleton();
51-
di.map("currentUser").to("app.lib.CurrentUserResolver").asRequestScoped();
52-
di.bind("INotifier").to("app.lib.SlackNotifier").asSingleton();
49+
local.di = injector();
50+
local.di.map("emailService").to("app.lib.EmailService").asSingleton();
51+
local.di.map("currentUser").to("app.lib.CurrentUserResolver").asRequestScoped();
52+
local.di.bind("INotifier").to("app.lib.SlackNotifier").asSingleton();
5353
```
5454

5555
Scopes are explicit. Transient is the default — a fresh instance per call. Singleton lives for the application lifetime. Request-scoped lives for the duration of one HTTP request, cached on `request.$wheelsDICache`. Auto-wiring of `init()` arguments matches registered names when no explicit `initArguments` are passed, which is the common case and the reason most service definitions fit on one line.

0 commit comments

Comments
 (0)