Hi,

I have a Java project which uses Spring to wire together various services, 
and the only way I've managed to find to integrate Clojure services 
(without using gen-class) is to have something resembling the 
MethodInvokingFactoryBean, or to manually write a wrapper which calls out 
to Clojure. Since everything else is instantiated in Spring, it'd be a lot 
nicer to have this sort of thing all in one place than scattered around, 
and Spring has support for creating beans with dynamic languages, but 
Clojure isn't currently one of those supported!

I've got most of the way towards having a patch which works, however I'm 
not entirely sure about the approach. Spring doesn't let beans constructed 
this way have constructor-injection, only by using setters. For now, I've 
abused the name attribute on property to give the fully qualified name of a 
function which binds a var with the value of the 'property'. This isn't 
ideal, but I can't think of another way of approaching this without 
defining a load of types on the fly and giving setter methods for those 
(maybe somebody else can?).

JIRA relating to the patch (with a quick explanation of why I've taken this 
approach): https://jira.spring.io/browse/SPR-11530
Dynamic language doc: 
http://docs.spring.io/spring/docs/4.0.3.BUILD-SNAPSHOT/spring-framework-reference/htmlsingle/#dynamic-language

Of particular interest in seeing quickly how it is used at present (since I 
doubt anybody else wants to go through the trouble of getting the whole 
thing set up in Eclipse..), may be..
https://github.com/Orkie/spring-framework/blob/SPR-11530/spring-context/src/test/java/org/springframework/scripting/clojure/clojureContext.xml
https://github.com/Orkie/spring-framework/blob/SPR-11530/spring-context/src/test/java/org/springframework/scripting/clojure/Messenger.clj

Any suggestions would be appreciated,
Adan

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to