| 1 |
= Springy -- Configure Spring contexts with JRuby |
|---|
| 2 |
|
|---|
| 3 |
Springy lets you use a simple Domain Specific Language (DSL) based on JRuby to wire up your Spring context. |
|---|
| 4 |
See {Wiring up Spring with JRuby}[http://www.trampolinesystems.com/weblog/wiring-up-spring-with-jruby] |
|---|
| 5 |
for an introduction. |
|---|
| 6 |
|
|---|
| 7 |
== Dependencies |
|---|
| 8 |
|
|---|
| 9 |
Springy requires {JRuby}[http://jruby.codehaus.org] (0.9.8), |
|---|
| 10 |
{Spring 2.0}[http://www.springframework.org] and the {Bean Scripting Framework}[http://jakarta.apache.org/bsf/]. |
|---|
| 11 |
|
|---|
| 12 |
== Usage |
|---|
| 13 |
|
|---|
| 14 |
You need to add springy.jar, bsf.jar and jruby-0.9.8.jar to your classpath. |
|---|
| 15 |
Create your context definition and put it somewhere in your classpath. To actually create the context do: |
|---|
| 16 |
|
|---|
| 17 |
import org.springframework.core.io.Resource; |
|---|
| 18 |
import springy.context.JRubyApplicationContext; |
|---|
| 19 |
|
|---|
| 20 |
// ... |
|---|
| 21 |
Resource r = new ClassPathResource("/path/to/context_definition.rb"); |
|---|
| 22 |
ApplicationContext ctxt = new JRubyApplicationContext(r); |
|---|
| 23 |
|
|---|
| 24 |
// serialize context to xml |
|---|
| 25 |
String context = ctxt.getContextAsXml(); |
|---|
| 26 |
|
|---|
| 27 |
== Serializing context to XML |
|---|
| 28 |
|
|---|
| 29 |
String serialized = new JRubyApplicationContext(r).getContextAsXml(); |
|---|
| 30 |
; |
|---|
| 31 |
== Building |
|---|
| 32 |
|
|---|
| 33 |
To build Springy from the source, you need to have Rake plus the |
|---|
| 34 |
{Jerbil}[http://code.trampolinesystems.com/jerbil] extensions |
|---|
| 35 |
installed. Once everything is installed, do |
|---|
| 36 |
|
|---|
| 37 |
% rake dist |
|---|
| 38 |
|
|---|
| 39 |
in the toplevel directory. |
|---|
| 40 |
|
|---|
| 41 |
== Example |
|---|
| 42 |
|
|---|
| 43 |
See the {test cases}[http://svn.trampolinesystems.com/springy/trunk/testsrc/springy/], especially the Ruby context |
|---|
| 44 |
{context.rb}[http://svn.trampolinesystems.com/springy/trunk/testsrc/springy/context.rb] and |
|---|
| 45 |
its XML equivalent {context.xml}[http://svn.trampolinesystems.com/springy/trunk/testsrc/springy/context.xml]. |
|---|
| 46 |
|
|---|
| 47 |
== FAQ |
|---|
| 48 |
|
|---|
| 49 |
See FAQ[http://code.trampolinesystems.com/springy/wiki/FAQ]. |
|---|
| 50 |
|
|---|
| 51 |
== Contact |
|---|
| 52 |
|
|---|
| 53 |
mailto:jan@trampolinesystems.com |
|---|
| 54 |
|
|---|
| 55 |
== Project homepage |
|---|
| 56 |
|
|---|
| 57 |
http://code.trampolinesystems.com/springy |
|---|
| 58 |
|
|---|
| 59 |
== License |
|---|
| 60 |
|
|---|
| 61 |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
|---|
| 62 |
in compliance with the License. You may obtain a copy of the License at |
|---|
| 63 |
|
|---|
| 64 |
http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 65 |
|
|---|
| 66 |
Unless required by applicable law or agreed to in writing, software distributed under the License |
|---|
| 67 |
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
|---|
| 68 |
or implied. See the License for the specific language governing permissions and limitations under |
|---|
| 69 |
the License. |
|---|