fsword / java_side Goto Github PK
View Code? Open in Web Editor NEW帮助rails项目利用旧的java资源,支持 maven、spring 整合
License: MIT License
帮助rails项目利用旧的java资源,支持 maven、spring 整合
License: MIT License
JavaSide ======== Add java support for jruby on rails. - maven support: third party jar dependency management, java class - spring support: springframework added, xml load...... - warbler compatible: you can use "warble" command to build your war Installation ============= rails plugin install git://github.com/fsword/java_side.git Maven Support ============= If you want to add a third-party java library, you just modify the pom file: $ vim $RAILS_ROOT/java/pom.xml Then run the task: rake java_side:jars The jar files will be put to the $RAILS_ROOT/java/jars and will be loaded when rails booting automatically. It also be packaged when you execute the warbler task Springframework Support ======================= - Add support 1.modify config/application.rb, and add a line like that: class Application < Rails::Application ... config.spring = true ... end 2.check java/pom.xml to make sure it has springframework's dependency(it has added by default pom.xml). 3.run the task: rake java_side:jars - Usage You can use get_bean function on your model, like this: class User < ActiveRecord::Base def doSth get_bean('your_bean_id').invokeTheService ... end end If you want to use your bean on other place, just include JavaSide::Spring: Loading development environment (Rails 3.0.6) jruby-1.5.6 :001 > include JavaSide::Spring => Object jruby-1.5.6 :002 > x = get_bean 'your_bean_id' => #<Java::......:0x496d864e> jruby-1.5.6 :003 > x.invokeTheService => ...... Ignoration ========== You can ignore this plugin by set environment - $ IGNORE_JAVA_SIDE=true rails c java_side is ignored Loading development environment (Rails 3.0.6) jruby-1.5.6 :001 > Copyright (c) 2010 fsword, released under the MIT license
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.