適用於Java Web開發者的十大必要的框架和庫

原文鏈接:https://www.java67.com/2018/02/top-10-open-source-frameworks-and-libraries-java-web-developers.html


Java programming language and platform has been fortunate in terms of frameworks, standards, and libraries, I guess which is one of the important reason for its huge success.

就框架、標準和庫方面而言,Java編程語言和平臺一直很幸運,我猜測這也是它獲得巨大成功的最重要的原因之一。

Apart from standard frameworks like Swing for desktop GUI application, JavaFX, Servlets and JSP, EJB, and JSF, there are a lot more open-source frameworks and libraries available for Java programmers.

除了像用於桌面GUI應用程序的Swing、JavaFX、Servlets 、JSP、EJB 和 JSF 標準框架,對Java程序員還有更多可用的的開源框架和庫。

These Open source framework, not only helps and speed up development but also enforce to use best practices required to build enterprise Java application and desktop application.

這些開源框架不僅僅幫助和加速開發,而且強制使用構建企業Java應用程序和桌面應用程序所需要的最佳做法。

Frameworks like Spring, which, in my opinion, gives a much-needed boost to the Java platform, enforces the Dependency Injection design principle at the core, which is crucial to building a loosely coupled system.

在我看來,像Spring框架,極大的促進了Java平臺的發展,強制執行依賴注入設計核心原則對於構建一個鬆散耦合系統至關重要。

Similarly, Struts and Spring MVC have made web development a lot easier, rather than just using Servlet and JSP.

相似地,Struts 和 Spring MVC 使得web開發變得容易得多,而不是僅僅使用 Servlet 和JSP。

Java Programmer, both beginners and experienced, must know about these frameworks, they not only help them in their work but also to get a Job as more and more companies are adopting framework based development.

無論是初學者還是有經驗的Java程序員,必須知道這些框架,它們不僅在工作中幫助Java程序員而且在他們找工作的時候,越來越多的公司採用基於框架的開發。

I have seen so many resumes that are not considered for interviews because there is no mention of Spring, Struts, or Maven.

我看過很多簡歷沒有被考慮面試,原因在於他們沒有提及Spring,、Struts、或Maven。

Though I don’t agree with this practice because if you are good at programming, OOP design, and Java, you can quickly learn those, it does happen in the real world, and there is no harm in mentioning these frameworks in your Resume if you have learned them.

雖然我不是很同意這種做法,因爲如果說你擅長編程,OPP設計和Java,你就可很快的學習這些,這種情況確實存在,如果你已經學會了這些,在你的簡歷裏提及這些框架是沒有危害的。

In this article, I will share the top 10 Java Frameworks for web developers, which include core Java framework, unit testing framework, Java web development framework, and, of course, build frameworks.

在這篇文章,我將會分享適用於web開發者的十大Java框架,包括核心Java框架、單元測試框架、Java web 開發框架,當然,還有構建框架。

It’s a good idea to at least know about these open-source Java libraries and frameworks so that you can learn them in detail when the need comes.

至少了解這些開源Java庫和框架是一個好主意,以便在需要時你可以詳細學習他們。

Here is my list of some of the necessary frameworks and libraries for Java web developers. The list includes web development frameworks like Spring MVC, Struts, Seam, Primefaces Google Web Toolkit, and ORM tools like Hibernate, testing libraries like JUnit and Mockito along with Eclipse RCP platform for creating desktop GUI in Java.

這是我爲Java Web開發人員準備的一些必要框架和庫的列表。該列表包括Web開發框架,例如Spring MVC、Struts、 Seam、 Primefaces Google Web 工具包,還有ORM工具如Hibernate,測試庫如JUnit 和Mockito 之類的庫以及用於在Java中創建桌面GUI的Eclipse RCP平臺。


1) Spring MVC

No doubt that Spring MVC is the best Java web development framework to date. In many ways, Spring made Java development more comfortable, streamlined and gives it much needed a boost.

毫無疑問Spring MVC 是迄今爲止最好的Java Web開發框架。在許多方面,Spring使Java開發更加舒適、效率更高並且使其急需增強。

Spring, on its core, provides an IOC container, which takes responsibility for managing System objects and wiring them together, but that’s just one of the Spring functionality.Spring has a suite of libraries, which is crucial for enterprise Java development.

就其核心而言,Spring提供了一個負責管理系統對象並把它們連在一起的IOC容器,但是那只是Spring功能之一。Spring有一套對於企業Java開發至關重要的庫。

Spring provides Spring Security, which a top-class Security framework, provides an easy way to implement LDAP authentication, Open ID authentication, Control on concurrent active sessions, and several other useful features Out of the box.

Spring提供了Spring Security,這是一個頂級安全框架,提供了一個簡單的方法來實現LDAP身份驗證、Open ID身份驗證、對併發活動的控制以及其他一些有用的功能。

Spring MVC is another pillar of the Spring framework, which provides an implementation of the Model View Controller design pattern, and also enforces several other Web-related best practices, like View Resolver.

Spring MVC是Spring框架的另外一個支柱,它提供了Model View Controller設計模式的實現,並且還實施了其他一些與Web相關的最佳方案,例如View Resolver。

The latest release of Spring 5 has also added support for Kotlin, the official language for Android development and some reactive programming features, which is very useful for developing modern web applications. Apart from these, there are a lot more Spring offers you, check Spring Masterclass to learn more about Spring.

Spring 5的最新版本還增加了對Kotlin的支持,Kotlin是Android開發的官方語言,並且具有一些響應式編程功能的特點,這對開發現代Web應用程序非常有用。除此之外,Spring提供了更多的信息,請查看Spring Masterclass以瞭解有關Spring的更多信息。

2) Struts 2.x

Before Spring, Struts was king of the Java web development framework. In his days, it was the best Java MVC framework and to date used in large companies. Web applications written during early 2000 are mostly written on Struts.

在Spring之前,Struts是Java Web開發框架的王者。在他的時代,它是迄今爲止最好的Java MVC框架,並已在大型公司中使用。2000年初編寫的Web應用程序大部分是用Struts編寫的。

Anyway, Struts has come a long way then. Struts 1.0 has gone, and today’s Struts is mostly Struts 2.0, see the difference between Struts 1 and 2. Despite the immense popularity of Spring MVC, Struts 2 still holds it’s placed.

無論如何,Struts已經走了很長一段路。Struts 1.0已經不存在了,今天的Struts主要是Struts 2.0,請看Struts 1和2之間的區別。儘管Spring MVC的普及程度很高,但Struts 2仍然佔有一席之地。

It’s good to develop simple web 2.0 applications. I believe legacy code with Struts 1.0 and the existing pool of Struts developers will keep this framework alive.

最好開發簡單的Web 2.0應用程序。 我相信Struts 1.0的遺留代碼和現有的Struts開發人員池將使該框架保持活力。

3) JUnit

JUnit is the best Unit testing framework for the Java application. Having JUnit on your resume makes a positive impression.

JUnit是Java應用程序的最佳單元測試框架。 在簡歷上寫使用過JUnit會給人留下積極的印象。

Though JUnit is there for a long time and almost become part of Java application development, it took a big leap with JUnit 4.0, which uses annotation to write unit tests even more easier.

儘管JUnit已經存在了很長時間,並且幾乎成爲Java應用程序開發的一部分,但它在JUnit 4.0上取得了長足的進步,JUnit 4.0使用註釋使編寫單元測試更加容易。

JUnit 4.0 annotations added a lot of convenience and power to unit test, It makes it easy to write a unit test for checking Exceptions. Though TestNG is another useful Java testing framework, JUnit has its own place.

JUnit 4.0批註爲單元測試增加了許多便利和功能,它使編寫用於檢查異常的單元測試變得容易。 儘管TestNG是另一個有用的Java測試框架,但JUnit擁有自己的位置。

The latest version of JUnit, JUnit 5.0, also has some useful features which make your test more readable and robust. If you are serious about learning the unit testing skill to improve your career prospects, I suggest to start now, and JUnit and Mockito Crash Course is the right place, to begin with.

最新版本的JUnit JUnit 5.0還具有一些有用的功能,這些功能使您的測試更具可讀性和魯棒性。 如果您認真地學習單元測試技能以改善您的職業前景,我建議立即開始學習,JUnit和Mockito Crash Course是適合的起點。

4) Maven

I am not sure if you agree to mention Maven as a framework, but to me, it looks like a build framework. Before Maven, ANT was prevalent, and almost all companies have their own build framework based on ANT. Now, Maven rules.

我不確定你是否同意將Maven作爲框架,但是對我來說,它看起來像一個構構建框架。在Maven之前,ANT很流行,幾乎所有公司都有基於ANT的自己的構建框架。現在,Maven統治了。

The biggest strength of Maven is convention over configuration; with ANT, you need to define everything, like source directory, target directory, etc. Maven enforces a standard project structure and uses reasonable default values to simplify the build procedure.

Maven的最大優勢是約定勝於配置。 使用ANT,您需要定義所有內容,例如源目錄,目標目錄等。Maven強制執行標準項目結構,並使用合理的默認值來簡化構建過程。

Another thing, which makes Maven a great Java framework is a concept of maven repository and dependency management, It’s super easy to include new dependency with Maven than managing a whole lot of JAR files.

使Maven成爲出色的Java框架的另一方面是Maven存儲庫和依賴項管理的概念,與管理大量JAR文件相比,將新的依賴項包含在Maven中非常容易。

If you don’t know Maven, start learning it now. Use Eclipse IDE and M2Eclipse maven plug-in. It’s worth learning. The Maven Quick Start is an excellent point to begin your journey.

如果您不瞭解Maven,請立即開始學習。 使用Eclipse IDE和M2Eclipse Maven插件。它值得學習。 Maven快速入門是開始您的旅程的絕佳選擇。

5) Hibernate

Spring and Hibernate were one of the most desired skills set a couple of years back. Though EJB 3.0 spoiled the party a bit, Hibernate is still a great Java persistence framework and worth learning. Projects either use JEE or Spring for development, and Hibernate fits well with Spring.

Spring和Hibernate是幾年前最需要的技能拍檔之一。 儘管EJB 3.0稍微破壞了聚會,但是Hibernate仍然是一個很棒的Java持久性框架,值得學習。 項目使用JEE或Spring進行開發,而Hibernate非常適合Spring。

Also, it’s one of the pioneers in the Object Relational framework, known as the ORM framework. Now there is a couple of alternatives available, like TopLink, but Hibernate is still the market leader.

此外,它還是對象關係框架(稱爲ORM框架)的先驅之一。 現在有幾種替代方法可供選擇,例如TopLink,但是Hibernate仍然是市場領導者。

Hibernate is also good skill in CV, and you are likely to see a couple of questions from Hibernate, like the difference between getting and load or save vs. update vs. persist during Java interviews for web development. If you want to learn more about essential Hibernate feature, then Hibernate, and JPA Fundamentals is an excellent place to start with.

Hibernate在CV方面也很熟練,您可能會從Hibernate中看到幾個問題,例如在Web開發的Java採訪中獲取和加載或保存與更新與持久化之間的區別。 如果您想了解有關基本的Hibernate功能的更多信息,那麼Hibernate和JPA基礎知識就是一個很好的起點。

6) PrimeFaces

PrimeFaces is a Java Framework that provides the JSF component to develop a rich web application. PrimeFaces delivers a rich set of components for Java Server Faces 2.0, like HtmlEditor, AutoComplete, Dialog, etc.

PrimeFaces是一個Java框架,它提供JSF組件來開發豐富的Web應用程序。 PrimeFaces爲Java Server Faces 2.0提供了一組豐富的組件,例如HtmlEditor,AutoComplete,Dialog等。

It also has built-in support for Ajax-based upon JSF 2.0 Ajax APIs. PrimeFaces is lightweight and easy to use. It also has excellent community support, which is key to the success of any open-source framework.

它還基於JSF 2.0 Ajax API內置了對基於Ajax的支持。 PrimeFaces輕巧且易於使用。 它還具有出色的社區支持,這對於任何開源框架的成功都是至關重要的。

7) Seam

Seam is a Java web framework from JBoss. There are a lot of good reasons mentioned in Why Seam’s page of Seam Framework. Some of them include its Ajax support, the easiest way to use EJB 3.0, and the best way to leverage JSF.

Seam是JBoss的Java Web框架。 在Seam的Seam框架頁面中提到了很多充分的理由。 其中一些功能包括對Ajax的支持,使用EJB 3.0的最簡單方法以及利用JSF的最佳方法。

Though I haven’t used Seam yet in any professional projects, It seems a useful web framework, which demands evaluation.

儘管我尚未在任何專業項目中使用Seam,但它似乎是一個有用的Web框架,需要評估。

8) Google Web Toolkit (GWT)

GWT or Google Web Toolkit is one of the best Java Web Frameworks from Google. GWT allows you to build a rich Java web application by providing powerful user interface capabilities.

GWT或Google Web Toolkit是Google最好的Java Web Framework之一。 GWT允許您通過提供強大的用戶界面功能來構建豐富的Java Web應用程序。

There are lots of plugins, tools, examples available from Google, which can help you to learn GWT quickly.

Google提供了許多插件,工具和示例,可以幫助您快速學習GWT。

Though the learning curve is a bit more if you are coming from Spring or Struts background. GWT can be used to developer browser-independent AJAX-based applications.

雖然如果您來自Spring或Struts,則學習曲線會更多一些。 GWT可用於開發獨立於瀏覽器的基於AJAX的應用程序。

9) Mockito

Mockito is a Java testing framework for creating mock objects. Though there are a couple more mock objects frameworks like JMock and EasyMock, Mockito is one of the best and easy to learn. Mockito has clean and straightforward syntax but, at the same time, rich enough to support that.

Mockito是用於創建模擬對象的Java測試框架。 儘管還有更多的模擬對象框架,例如JMock和EasyMock,但是Mockito是最好的和易於學習的框架之一。 Mockito具有簡潔明瞭的語法,但同時又足夠豐富以支持該語法。

One of the drawbacks of Mockito is that it doesn’t support mocking of static methods, but you can use combine Mockito with JMockit to do that.

Mockito的缺點之一是它不支持靜態方法的模擬,但是您可以將Mockito與JMockit結合使用。

Apart from JUnit for unit testing, learning one of the mock object frameworks gives a new edge to your unit testing capability, and if you are looking for an excellent resource to get going, then is Mockito Tutorial: Learn mocking with 25 Junit Examples a great place, to begin with.

除了用於單元測試的JUnit之外,學習一種模擬對象框架還可以爲您的單元測試功能帶來新的優勢,如果您正在尋找一種出色的資源來學習,那麼Mockito教程:通過25個Junit示例學習模擬非常有用 的地方,開始。

10) Eclipse RCP platform

Eclipse RCP is one of the best Java frameworks for developing a rich desktop application. By the way, when it comes to building desktop applications in Java, Swing rules, but Eclipse RCP is no way behind. It’s free, has excellent tutorials and proper documentation.

Eclipse RCP是用於開發豐富的桌面應用程序的最佳Java框架之一。 順便說一句,當涉及到用Java構建桌面應用程序時,Swing會遵守規則,但是Eclipse RCP絕不落後。 它是免費的,具有出色的教程和適當的文檔。

That’s all on this list of Top 10 Java frameworks and Libraries guys. Java is rich, very rich, and there are a lot of open source web frameworks available in Java, It’s often a good idea to do some Googling before choosing any web framework for development. Apart from mentioned above, let us know which Java framework you have been using, which are your favorites ones.

這就是十大Java框架和庫專家的名單。 Java是豐富的,是非常豐富的,並且有許多可用的Java開放源Web框架。在選擇任何Web框架進行開發之前,最好先進行一次Google搜索。 除了上面提到的,讓我們知道您一直在使用哪個Java框架,哪個是您最喜歡的Java框架。

Thanks for reading this article so far. If you find these open-source Java web development libraries useful, then please share it with your friends and colleagues. If you have any questions or feedback, then please drop a note.

感謝您到目前爲止閱讀本文。 如果您發現這些開源Java Web開發庫很有用,請與您的朋友和同事共享。 如果您有任何疑問或反饋,請留下筆記。

發佈了62 篇原創文章 · 獲贊 92 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章