Java IoC 框架,OfficeFloor 2.0.0 发布
openkk 13年前
<p><a href="/misc/goto?guid=4958329199279204125" target="_blank">OfficeFloor </a>是一个 IoC 2.0 的实现,主要是聚焦于方法的依赖注入而不是对象。OfficeFloor 还拥有一个基于Eclipse的图形化配置插件,示例代码:</p> <pre class="brush:java; toolbar: true; auto-links: false;">// OfficeFloor source to create an inline HTTP Server (useful for testing a single web page). // Note that applications would be configured using the WoOF graphical configuration. HttpServerAutoWireOfficeFloorSource server = new HttpServerAutoWireOfficeFloorSource(); // Add a dynamic web page (ExampleBean provides the page logic and is just a POJO) server.addHttpTemplate("example.html", ExampleBean.class); // Add configured DataSource for dependency injection server.addManagedObject(DataSourceManagedObjectSource.class, null, DataSource.class).loadProperties("datasource.properties"); // Assign Team (specific thread pool) responsible for executing the methods with a DataSource dependency server.assignTeam(LeaderFollowerTeamSource.class, DataSource.class).addProperty("size", "10"); // Start the HTTP Server server.openOfficeFloor();</pre> <br /> <br /> 如下图所示: <p></p> <p><img title="15204659_qtps.png" border="0" alt="15204659_qtps.png" src="https://simg.open-open.com/show/c0bfa567507b7c8fdd4c85f632d70adf.png" width="464" height="217" /><br /> <br /> OfficeFloor 2.0.0 发布,该版本主要改进包括:在 OfficeFloor 的整个 IoC 基本面上的涉及到依赖注入、线程注入、功能编排上都增加了 Context 上下文信息,该功能特别适用于事务管理的图形化配置上。</p>