Dynamic Proxy vs Scripting in java

In case of customize object behavior at runtime, Java seems to provide two solutions, Java Scripting and Dynamic Proxy.

suppose I have a configuration file and an interface I in Java, I can either create and load class implementing I according to configuration or I can use dynamic proxy to make implementation of the I as well. Both technique is a little advanced. I am now wondering

1- which of these two ways is more efficient in development? 2- which of these technology is more optimized in performance? 3- which way is more maintainable? (before product is stable, configuration might be changed frequently)

Sincerely


I think the first technique is the most widely used one. I have never used dynamic proxy to be honest, but coding against an interface and then determining the concrete type based on configuration is simply the inversion of control concept (or dependency injection) which is used in Spring and adopted by many other frameworks as well.

链接地址: http://www.djcxy.com/p/82202.html

上一篇: 熊猫,groupby,并在团体中找到最大值,返回值和数量

下一篇: 在java中的动态代理与脚本