Play Framework怎麼樣?
約定優於配置僅
播放有幾個配置文件。其大部分結構是按慣例。 對於示例的基本結構是這樣的:
|
+---/app - All executable artifacts go here (java files, conf files and view templates).
| |
| +---/model - Your model Java classes.
| |
| +---/view - Your view templates.
| |
| +---/controller - Your controller classes
|
|---/conf - Contains all configuration files for the application. Initially contains application configuration and routing table.
|
|---/lib - Libraries your appliaction needs. Added automatically to classpath.
|
|---/log
|
|---/public - Public stuff are your static assets that your server gives directly
|
|---/test
|
|---/tmp - All your temporarily compiled .class files are here
沒有XML配置,除了web.xml中
播放沒有XML配置,包括無web.xml中。它有一個路由文件。看下面的例子,它用於路由。
純Java(無斯卡拉,沒有Groovy中,...)
它是純Java的,但你可以通過插件使用的Scala或Groovy。
- 自然REST風格的URL,例如/新聞/ 2011 /月(不。做,沒有.JSP,...)
- REST感知
從現場:
Play is a real "Share nothing" system. Ready for REST, it is easily scaled by running multiple instances of the same application on several servers.
在一個休息其實路由喜歡的方式是很容易的:
# Play 'routes' configuration file…
# Method URL path Controller
GET / Application.index
GET /about Application.about
POST /item Item.addItem
GET /item/{id} Item.getItem
GET /item/{id}.pdf Item.getItemPdf
不難猜測,一旦習慣了玩一下,哪裏就會出現。
- 它不應該強迫我到應用服務器上部署(例如EJB應選配)
事實並非如此。實際上,您可以通過保存文件進行部署。 EJB是完全可選的,所以.war
,.ear
和其他形式的部署也是如此。
代碼生成在Rails的將是真棒,但不是強制性的
我不認爲它確實很多代碼生成,但我不是100%。它會自動創建所有必需的文件夾並實例化一個基本示例頁面。我不知道Rails是否會生成其他內容......
MVC將是很好的,但
- 我希望能夠選擇的M部,選擇我自己的(無捆綁)的持久性庫。
- 爲視圖,既不HTML,JAVASCRIPT,也不CSS
沒有自動生成的代碼 - 集成的模板語言將是很好的,但它應該是簡約(簡單的控制流程,
見MVC in Play
其他優點:
- 這很有趣,將程序中
- 我提到,允許你保存源文件重新部署應用的熱插拔。?
- 偉大的錯誤日誌。
缺點:
爲什麼說春天3功虧一簣?我認爲它滿足你想要的所有功能。你可以做很多基於annonation的配置。它太重量級了嗎? –
@Ray Toal:我不得不承認我與Spring的經歷是前一段時間。當時它感覺很龐大,而且有太多的魔力,依賴注入正在爲我的口味而發生。但這可能已經改變。你會有一些鏈接可以證明它符合描述嗎?高興地檢查出來,提前致謝! – emboss
如果您尋找不臃腫的框架,我不會使用Zend作爲比較。 – Perception