java - Package jruby script as .jar with annotations -


is there way package jruby script .jar file support annotations? don't think warbler this. jruby2java looks supported annotations hasn't been updated in 4 years.

the jruby compiler, part of core jruby features, has java_annotation method allows define annotations in jruby code.

here example spring mvc annotations, annotations added on class greetingcontroller, , on print method:

java_import 'org.springframework.stereotype.controller' java_import 'org.springframework.web.bind.annotation.requestmapping' java_import 'org.springframework.web.bind.annotation.requestmethod' java_import 'org.springframework.ui.modelmap'  java_package 'com.weblogism.myapp' java_annotation 'controller' java_annotation 'requestmapping("/welcome")' class greetingcontroller    java_annotation 'requestmapping'   java_signature 'string print(modelmap model)'   def print(model)     model.add_attribute('greeting', 'hello, world!')     "index"   end end 

(the full example can found on github; jruby compiler called jruby-maven-plugin)


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -