This article shares the first article of LibrarySystem library management system development for your reference. The specific content is as follows
SSM construction process:
The general process of creating an idea project
Open idea ---> File ---> new ---> project ---> maven --->
create from archetype ---> maven-archetype-webapp ---> Next, it is usually the default
Finally, create a new java and resources folder in the main directory.
Step 1: Add Spring, Spring MVC, Mybatis dependencies
All are provided with detailed instructions, so I will not repeat them here
pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.ray</groupId> <artifactId>LibrarySystem02</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <name>LibrarySystem02 Maven Webapp</name> <!-- FIXME change it to the project's website --> <url>http://www.example.com</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <!-- Configure variable version number --> <logback.version>1.1.1</logback.version> <mysql.version>5.1.18</mysql.version> <com.alibaba.druid.version>1.1.9</com.alibaba.druid.version> <com.mybatis.mybatis.version>3.4.1</com.mybatis.mybatis.version> <com.mybatis.mybatis_spring.version>1.3.0</com.mybatis.mybatis_spring.version> <javax.servlet.version>3.1.0</javax.servlet.version> <org.springframework.version>4.3.2.RELEASE</org.springframework.version> <slf4j.version>1.7.18</slf4j.version> <log4j.version>1.2.17</log4j.version> <jackson-mapper-asl.version>1.9.13</jackson-mapper-asl.version> <jackson.version>2.9.2</jackson.version> <fastjson.version>1.2.47</fastjson.version> <org.mybatis.generator.version>1.3.5</org.mybatis.generator.version> </properties> <dependencies> <!-- Unit Test--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <!-- 0.Log--> <!-- Implement slf4j interface and integrate--> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>${logback.version}</version> </dependency> <!-- 1.Database--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> <scope>runtime</scope> </dependency> <!--druid Alibaba Database Connection Pool--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${com.alibaba.druid.version}</version> </dependency> <!-- DAO: MyBatis --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>${com.mybatis.mybatis.version}</version> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>${com.mybatis.mybatis_spring.version}</version> </dependency> <!-- 2.Servlet web --> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <!--Servlet Version Settings--> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>${javax.servlet.version}</version> </dependency> <!-- 3.Spring --> <!-- 1)Spring Core--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${org.springframework.version}</version> </dependency> <!-- 2)Spring DAO layer--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${org.springframework.version}</version> </dependency> <!-- 3)Spring web --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${org.springframework.version}</version> </dependency> <!-- Input JSON --> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>${jackson-mapper-asl.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>${jackson.version}</version> </dependency> <!-- Add fastjson --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${fastjson.version}</version> </dependency> </dependencies> <build> <finalName>LibrarySystem02</finalName> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <artifactId>maven-clean-plugin</artifactId> <version>3.0.0</version> </plugin> <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.20.1</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>3.2.0</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> <!-- Reverse Engineering mybatis-generator --> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>${org.mybatis.generator.version}</version> <configuration> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> <dependencies> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>${com.mybatis.mybatis.version}</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> </dependencies> </plugin> </plugins> </plugins> </pluginManagement> </build> </project>Step 2: Add a database
Here you need to create a database called: library
The table creation statement is as follows:
# Host: localhost (Version 6.0.11-alpha-community) # Date: 2018-05-22 20:31:40 # Generator: MySQL-Front 6.0 (Build 2.20) # # Structure for table "book" # DROP TABLE IF EXISTS `book`; CREATE TABLE `book` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `book_name` varchar(255) NOT NULL, `book_writer` varchar(255) NOT NULL, `book_publisher` varchar(255) NOT NULL, `book_isrent` bigint(20) NOT NULL, `book_person` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; # Data for table "book" # INSERT INTO `book` VALUES (1,'machine learning','Zhou Zhihua','Tsinghua University Press',1,'linyue'),(2,'Practical machine learning','People','People' Posts and Telecommunications Press',1,'linyue'),(4,' Introduction to Algorithm','Thomas','Mechanical Industry Press',0,' '); # # Structure for table "user" # DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `id` bigint(11) NOT NULL AUTO_INCREMENT, `user_name` varchar(40) NOT NULL, `user_email` varchar(50) NOT NULL, `user_pwd` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; # Data for table "user" # INSERT INTO `user` VALUES (1,'linyue','[email protected]','123'),(3,'rain','[email protected]','222'),(4,'ray','[email protected]','333'),(5,'test','[email protected]','123');
Download the complete project demo: LibrarySystem02
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.