Using lein-ring
plugin, I attempt to pass a configurator
function to the ring jetty adapter. The minimal project.clj
which reproduces the problem, and which is inspired by this SO answer, is:
(defproject sample "0.1.0-SNAPSHOT"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.6.0"]
[ring/ring-defaults "0.1.2"]]
:plugins [[lein-ring "0.9.7"]]
:ring {:handler sample.handler/app
:adapter {:configurator ~#(println (.getClass %))}}) ; whatever...
The problem with this, is that it fails with a following error:
$ lein ring server-headless
Exception in thread "main" java.lang.RuntimeException: No reader function for tag object, ...
...
Declaring a function with fn
form or defn
separately doesn't impact the outcome. Now I realize this is probably not related to lein-ring
itself, but I only reproduced the problem on a :configurator
(that is, for example, calling a function to set a project description works fine).
I would like to understand, why this is happening (and understand the error message itself first of all), and, in the end, how to actually pass a configurator function when using lein-ring
plugin.