Basic introduction
Jar packages are some classes that others have written, and then package these classes. You can introduce these jar packages into your project, and then you can directly use the classes, attributes and methods in these jar packages.
JAR (Java ARchive) combines a series of files into a single compressed file, just like Zip. However, like everything else in Java, jar files are cross-platform, so you don't have to worry about platform-specific issues.
JAR files are particularly useful when it comes to Internet applications. Before the JAR file, the web browser must repeatedly request the web server to download all the files that constitute an "applet". Otherwise, every file is uncompressed. But after merging all these files into a JAR file, you only need to make a single request to the remote server. At the same time, due to the use of compression technology, all data can be obtained in a shorter time.
Background introduction
MyBatis is an excellent persistence layer framework that supports ordinary SQL queries, stored procedures and advanced mapping. MyBatis eliminates almost all JDBC code and manual setting of parameters and retrieval of result sets. MyBatis uses simple XML or annotations for configuration and original mapping, mapping interfaces and Java POJOs (Plain Ordinary Java Objects, ordinary Java objects) into records in the database.
Each MyBatis application mainly uses SqlSessionFactory instances. A SqlSessionFactory instance can be obtained through SqlSessionFactoryBuilder. SqlSessionFactoryBuilder can be obtained from an xml configuration file or an instance of a predefined configuration class.
Building a SqlSessionFactory instance from an xml file is a very simple matter. It is recommended to use a classpath resource in this configuration, but you can use any Reader instance, including instances created with a file path or a URL starting with file://. MyBatis has a utility class, Resources, which has many methods to easily load resources from the classpath and other locations.
How to use
1. Right-click "Project" → select Properties, select Java Build Path in the list on the left side of the pop-up dialog box, select "Add Library" in the pop-up dialog box, select "User Library" in the pop-up dialog box, and then select → Next
2. In the dialog box that appears, you can select the user-defined library that has been created, or select User Libraries. Select "New" in the new dialog box that pops up to create a new user-defined library.
3. In the user-defined library to be created, enter the name of the new custom library.
4. Then add the required Jar package for the new library
5. After adding user-defined libraries according to the above steps, you can reuse these defined User Libraries in the future to save time for development.
it works
it works
it works