Pretty simple: ;; Load Spring stuff only if not already done (let [v (def *context*)] (when-not (. v isBound) (. v bindRoot (new ContextLoader "higiebusRouting.xml")) (. *context* load)) )
(def producer (. com.softaddicts.products.higiebus.core.BeanLoader getBean "jmsProducer")) ... (jms/sendMessage producer (str "SEND TO [" (get endpoint :name) "/" (get endpoint :host) ":" (get endpoint :port) "] SUCCEEDED " (char 13) msg)) ... I have a Java class to create and load a Spring context (ContextLoader) and another one to load beans on demand (BeanLoader). The things were part of the prototype we built this summer, we wanted to speed up the prototype schedule so we used Spring to save us from writing a few hundred code lines. When we moved to Clojure for the bus core logic, we wanted to reuse the prototype components and the Spring beans almost as is. We wrapped the beans with some Clojure code, presently is not very sophisticated but we concentrate on the core bus logic. later we will revisit this low level code and improve it. So basically, you need some java code to create the Spring context and some code to load the beans on demand. We avoided POJOs invoked by the Spring framework for the moment but later we will look at the possibility of getting Clojure code invoked by Spring using some code bridge in Java. Luc On Wed, 2008-10-29 at 09:53 -0400, Stuart Halloway wrote: > Hi Luc, > > Do you have any special sauce for Spring/Clojure integration that the > community might be interested in? Or is it just so easy that there is > nothing to say? :-) > > Stuart > > > Debugging presently with JSwat and it works fine. We have extensive > > logging (javalog) and use some trace macros > > from time to time. > > > > Of course you have to get acquainted with the internal Clojure > > representation as shown by the debugger but that's not a big > > learning curve. > > > > Presently we use a mix of Spring beans, Java and Clojure components. > > > > Luc > > > > On Tue, 2008-10-28 at 11:58 -0700, Scott Hickey wrote: > >> > >> It should work. Before I had a debugging working in Eclipse with > >> Groovy, I used JSwat, JEdit and Ant for project work with success. > >> > >> Scott Hickey > >> Senior Consultant > >> Object Partners, Inc. > >> > >> > >> > >> ----- Original Message ---- > >> From: Bill Clementson <[EMAIL PROTECTED]> > >> To: clojure@googlegroups.com > >> Sent: Tuesday, October 28, 2008 1:43:58 PM > >> Subject: Re: Using a Java Debugger with Clojure > >> > >> > >> Hi Peter, > >> > >> On Tue, Oct 28, 2008 at 11:27 AM, Peter Wolf <[EMAIL PROTECTED]> > >> wrote: > >> > > >> > Hello all, > >> > > >> > I am new to Clojure, but not Java or LISP (I used to work at LMI). > >> > > >> > I am considering a project written in a mixture of Clojure, Java > >> and > >> > Groovy. Clojure for the concurrent inner loop. Groovy/Grails > >> for the > >> > Web UI. And lots of Java reused from other projects. > >> > > >> > How would I debug something like this? Can I compile Clojure so > >> that a > >> > standard Java debugger understands it? > >> > >> I don't know about Groovy, but some people have used standard Java > >> debuggers to debug Clojure code. For example: > >> > >> 1. Read Rich's section on debugging in "Getting Started": > >> http://clojure.org/getting_started#toc5 > >> 2. Have a look at my blog post: http://bc.tech.coop/blog/081023.html > >> 3. There was a recent discussion on this group where another > >> individual had some problems getting JSwat working: > >> http://groups.google.com/group/clojure/browse_thread/thread/403e593c86c2893f# > >> 4. A general search for "debugger" on this group will also bring up > >> some other relevant threads. > >> > >> > Is there a better way? > >> > >> "Better" is subjective. ;-) > >> > >> You could use "traditional" lisp debugging techniques as well. I've > >> covered some of these on my blog: > >> http://bc.tech.coop/blog/040628.html > >> > >> Cheers, > >> Bill > >> > >> > >> > >> > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---