IoC 框架,OfficeFloor 2.2.0 發布

jopen 12年前發布 | 9K 次閱讀 IoC

OfficeFloor 是一個 IoC 2.0 的實現,主要是聚焦于方法的依賴注入而不是對象。OfficeFloor 還擁有一個基于Eclipse的圖形化配置插件,如下圖所示:

IoC 框架,OfficeFloor 2.2.0 發布

OfficeFloor 2.2.0 發布,該版本集成 GWT 的 DevMode 用于在 Eclipse 中運行 OfficeFloor Web 應用,可大大的方便開發和調試。

// 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();

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!