读书人

spring bean0配置框架Spring-Ext发布

发布时间: 2012-11-16 14:12:14 作者: rapoo

spring bean零配置框架Spring-Ext发布
bamboo-spring-ext 1.0.1 版。
google code地址: http://code.google.com/p/bamboo-spring-ext/

去年项目中对Spring的简单封装,实现bean零配置。
设计原因和目的:
1) 简化Spring下业务 bean 的集成方式,减少不必要配置;
2) 支持无Annotation的纯 Java POJO,便于 POJO 进行不同形式的的集成;
3) 对遗留系统以最简单的方式和Spring集成,以使用Spring的AOP容器等功能;

现有时间将其打包,写点userguide,分享出来。 后续计划将其他微小但实用的特性也打包进来。

*bamboo-spring-ext* allow you to create a java object automatically and dynamically binded with Spring container without need to config bean. Spring AOP also worked with those beans.

Code example as following:

   import org.bamboo.spring.*;   //default scope is prototype   OrderService orderService = (OrderService) BeanFactory.createBean(OrderService.class);   orderService.deleteOrder("AA001");

   //singleton demo:   OrderService orderService = (OrderService) BeanFactory.createBean(OrderService.class, true);


applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?><beans>    <!-- no <bean/> config is needed by bamboo-spring-ext tool. -->   <!-- Below is a demo for AOP also works with those bean  not configed above. -->     <bean id="logAdvisor" />    ..... see userguide and test package for details.


2, 容器中的AOP Advisor,Interceptor 等能自动对这些Bean进行proxy代理, 达到与配置的bean 同样的效果。

1 楼 wendong007 2009-03-02 你所谓的零配置就是把配置从XML转移到Java文件中吗?这样做有什么意义?或者说这么用Spring还有什么意义? 2 楼 Arden 2009-03-05 现在spring2.5自己本身都有零配置了~~ 3 楼 wendong007 2009-03-05 楼上所说的零配置是指注解方式配置吗?

虽然注解方式配置很方便,但这不应该叫零配置,而且我觉得IOC根本不可能实现零配置,除非你根本不用,那就真的不需要配置了

读书人网 >软件架构设计

热点推荐