Java is one of the most powerful programming languages in the world, and many developers and large enterprises prefer Java and use it in a variety of scenarios. In this article, we introduce several Java libraries to help developers solve a variety of related issues that they encounter in programming.
One, the Java core extension
Java's standard library provides some of the most basic data type operations, but still lacks useful tool classes for some common requirements scenarios. Others are that the Java standard library itself is not perfect and needs to be supplemented by third-party libraries.
1. Apache Commons Lang
Apache Commons Lang is the most famous Java library of Apache, it is a good extension of the Java.lang, contains a lot of very useful tool classes, which use the most stringutils,dateutils,numberutils and so on.
Download
In addition to Apache Commons Lang, there are other Apache libraries that are good additions to Java itself, such as Apache Commons collection,apache Commons io,apache Commons Math.
2, Google guava
Google Guava contains some of the core Java libraries that Google uses in its own Java projects. Includes support for various aspects of collections, caches, concurrency libraries, string processing, I/O, and so on. In addition, Google developed libraries are always known for performance.
3, Joda-time
Java SE 8 Prior to the Java version of the support is poor, joda-time is often used to replace the original date system, it can support more calendar system, and provides a lot of very convenient date processing method, and its performance is very good.
second, the web framework
Web frameworks are the most central part of an application, so I always recommend using the most standard and well-supported frameworks, such as spring and struts.
1. Spring
Download
Spring is an open-source application framework that contains many sub-projects such as Spring MVC, Spring Security, Spring data,sping boot, and so on, to meet almost all of your project needs. It is also the preferred back-end framework for my web project development.
2, Struts 2
Struts 2 is the most famous web framework of Apache, and it is also a free, open source MVC framework. Struts can also support the latest technologies such as Rest,soap,ajax.
In addition to the two most common web frameworks mentioned above, there are some excellent frameworks to choose from, such as Google Web Toolkit, Tapestry, and strips.
third, the database (persistent layer)
The choice of a durable layer framework is also critical to the success or failure of a project, which directly affects the performance, quality, security, and stability of the system.
1, MyBatis
Download
MyBatis is my favorite database (persistence layer) framework, because it is completely SQL-based (extracting data from SQL and automatically mapped to the desired data object), which gives me enough flexibility.
2. Spring jdbc/spring Data
Spring JDBC is not a standalone spring subproject, but rather a module that is integrated within the spring core library to provide basic encapsulation processing for JDBC operations. With a simple configuration, the results can be obtained by invoking the JdbcTemplate in the context.
Spring data is a sub-project of spring, providing a more powerful package of persistence layer functionality, and object mapping capabilities. It can be well integrated with spring MVC. You can use JPA and crudrepository to greatly simplify the development of persistent layers.
3. Hibernate
Download
Hibernate may be the most widely used persistent layer framework in the country, it is very powerful, but it is not easy to use it, you need to understand its internal mechanism, otherwise there may be some unforeseen performance problems, especially when the amount of data is particularly large.
In addition to some of the most commonly used persistence layer libraries, there are several excellent libraries, such as Jdo,jooq,apache dbutils, etc.
Iv. Log
There is also a logging feature in Java, but it is not good enough to handle log ratings, log storage, and log backups and archives, so we typically use third-party log libraries to process logs in a project.
1, slf4j-simple Logging facade for Java (SLF4J)
Download
SLF4J provides us with a log service abstraction layer, based on which you can choose different log implementations, For example: java.util.logging,logback,log4j, when you need to change the log implementation component, do not need to modify any code, just need to change some of the corresponding configuration.
2. Apache log4j
Log4j is the most famous log component, which can easily be recorded in the program by simple configuration, and its log files can be named and archived according to different rules.
3, Logback
Logback is newer than log4j, and it is considered a substitute for log4j. It is better than log4j performance, and more complete implementation of the SLF4J interface, and comes with more features, such as automatic compression log, more filter and so on.
4. JSON
JSON has become the most widely used data transmission format, so the processing of JSON in the program is becoming more and more.
Here are some of the JSON processing libraries I recommend:
Download
1) Jackson
Jackson is a multi-purpose Java library for working with JSON data. It makes it easy to convert between JSON data and Java objects.
2) Google Gson
The JSON library, developed by Google, enables the conversion between JSON strings and Java objects, which is also very convenient to use.
v. Charts
1, Jfreechart
Download
Can generate various types of charts for you, and support a variety of output formats, including PNG and JPEG picture formats, as well as vector graphics such as pdf,eps,svg.
2, JasperReports
JasperReports provides a complete set of reporting solutions that help users develop programs with reporting capabilities using the Java language. The jasperreports template uses XML format to extract data from the database and generate reports in a variety of formats, such as PDF, HTML, XLS, CSV, and XML. One of its big advantages is the ability to handle large amounts of data in reports.
VI. Testing
JUnit
JUnit is currently the most widely used Java unit Test library through which you can easily write your own unit test code and perform automated testing.
VII. Office Document processing
1. Apache POI
Download
Apache POI is a free open source library for working with Microsoft Office documents. With it you can use Java to read and create, modify MS Excel files, MS Word and Mspowerpoint files.
2, docx4j
Docx4j is another set of JAXB-based Office document (DOCX,PPTX,XLSX) processing libraries.
Eight, XML parsing
1, JDOM
Download
JDOM is an open source project that uses pure Java technology to parse, generate, serialize, and manipulate XML documents based on the tree structure. In JDOM, XML elements are represented by element, XML attributes are represented by Attribute, and XML documents themselves are represented by document. So these APIs are very intuitive to use.
2, dom4j
DOM4J is an open-source framework for working with XML, which integrates techniques for XPath and fully supports DOM,SAX,JAXP.
3, Xerces
Xerces is an open source XML parser. From JDK1.5 onwards, Xerces becomes the XML default implementation of the JDK.
Ix. Other interesting code libraries
1, Jsoup
Jsoup provides a set of APIs that interact with the external Internet's Web pages (HTML), allowing users to easily parse HTML pages with CSS selectors to get the content they need.
2, Lomobok
Lombok is a Java utility that can be used to help developers eliminate the verbosity of Java, especially for simple Java objects (POJO). It does this through annotations. By adding Lombok to the IDE, developers can save on building methods such as hashcode () and Equals () and the amount of time previously used to classify various accessor and mutator.
3, Netty
Netty is a Java open source framework provided by JBoss. Netty provides asynchronous, event-driven network application frameworks and tools for rapid development of high-performance, high-reliability network servers and client programs. In other words, Netty is a NIO-based client, a server-side programming framework that uses Netty to ensure that you quickly and simply develop a Web application, such as a client that implements some kind of protocol, a service-side application.
Java developers need to know what common development tools