|
From: Rob H. <ro...@in...> - 2006-06-20 08:03:24
|
This is something that Adrian and I have been discussing for some time. In theory it is entirely possible, but we have all seen enough horror at the hands of classloaders to know that it isnt entirely trivial. One interesting thing to note is that all valid Java programs are valid Groovy programs. Another area that may be of interest to many people is the ability to embed the JDT compiler from Eclipse to compile sources on the fly. In practice on the fly compilation for certain classes that are hidden behind statically compiled interfaces is not tremendously difficult. The issues arise when you start to talk about dynamically compiling the entire application and arbitrarily replacing individual pieces. This can result in some very interesting dependency issues. Rob On 20 Jun 2006, at 08:47, Niklas Therning wrote: > Nicolas De Loof wrote: >> Hello guys, >> >> I've looked at new script support and sounds great for quick >> design or >> prototyping "edit source code, hit refresh and get the result", >> BUT it >> requires to learn yet another langage. >> I can agree that "grrovy is great" or "bsh is java like" or any other >> enthousiastic comment on scripting languages, but my development team >> has lots of junior java developers and my hierarchy has lot's of old >> schools men that will make very difficult to accept a "script" >> language >> as a valid technology. >> >> I'm looking for a way to code scripted spring beans as 100% Java >> source >> code, using full IDE support, so that developer doesn't have to know >> some class is used a scripted bean and some other as compiled >> code. My >> first think comes to JSP that are runtime compiled (an re- >> compiled) by >> the container. It would be great to have a similar support for >> java code >> to be "runtime re-compilable". When the code gets fine, it can be >> classicaly compiled into a .class and pakaged into the app, by simply >> changing the spring context. >> >> Looking at the way tomcat (jasper) compiles JSP, it seems it uses a >> custom classloader to load the runtime-compiled .class. My experience >> with classloaders is limited so I can say if it would be easy, but >> here >> is how I'd see this : a FactoryBean creates a proxy for the bean >> interface and delegates invocation to a "runtime-compiled" class in a >> child classloader. Hot recompilation requires the bean to be >> stateless, >> but this sounds an aceptable constraint if I can code my web >> controlers >> or business services by a quick code/test/code. >> >> Thanks for any suggestion to make this a reality. >> >> Nico. > > Janino, http://www.janino.net/, is a small footprint Java compiler. > It's > mostly Java 1.4 compatible. Haven't used it myself yet but it looks > interesting. It includes a classloader which loads classes directly > from > Java sources, http://www.janino.net/use.html#class_loader. > > Regards, > Niklas > > > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > -- Rob Harrop VP, Technology Strategy Interface21 - Spring Services from the Source http://www.springframework.com |