Cet article partage le premier article du développement du système de gestion des bibliothèques de bibliothèque pour votre référence. Le contenu spécifique est le suivant
Processus de construction SSM:
Le processus général de création d'un projet d'idées
Ouvrir l'idée ---> Fichier ---> nouveau ---> Projet ---> Maven --->
Créer à partir d'archétype ---> maven-archetype-webapp ---> Ensuite, c'est généralement par défaut
Enfin, créez un nouveau dossier java et ressources dans le répertoire principal.
Étape 1: Ajouter les dépendances du printemps, du printemps, MyBatis
Tous sont fournis avec des instructions détaillées, donc je ne les répéterai pas ici
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: ScheMalation = "http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modersversion> 4.0.0 </ Modelversion> <proupId> COM.RAY </proncId> <ArtifActid> LibeldSystem02 </rayRay>> <ArtifActid> LibeldSystem) <version> 1.0-snapshot </ version> <packaging> war </ packaging> <name> LibrarySystem02 maven webApp </name> <! - FixMe le modifie en site Web du projet -> <url> http://www.example.com </url> <Properties> <project.build.sourceencoding> utf-8 </project.build.sourceencoding> <maven.compiler.source> 1.7 </maven.comPiler.source> <maven.compiller.target> 1.7 </maven.comPiler.target> <! - Configurer le numéro de version varable -> <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 <org.springframework.version> 4.3.2.release </org.springframework.version> <lf4j.version> 1.7.18 </slf4j.version> <log4j.version> 1.2.17 </log4j.version> <Jackson-Mapper-Asl.Version> 1.9.13 </jackson-misper-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> </ groudid> <! <ArtefactId> JUnit </ artifactid> <in version> 4.11 </ version> <ccope> Test </ccope> </Dependency> <! - 0.log -> <! - Implémentez l'interface SLF4J et intégrer -> <dependency> <proupId> ch.qos.logback </proupId> <Artifactid> Logback-Classic </ ArtifActid> <version> $ {logback.version} </ version> </ dépendance> <! - 1.Database -> <dependency> <proupId> MySql </prôdId> <Derogne> {MySQL-Connector-Java </Reting> Runtime </ Scope> </Dedency> <! Pool de connexion de la base de données -> <dependency> <groupId> com.alibaba </prôned> <artifactId> druid </ artifactid> <version> $ {com.alibaba.druid.version} </prewing> </dEpendency> <! - Dao: Mybatis -> <Dedency> <proupId> Org.Mybatis </proupid> <ArtefactId> Mybatis </ artifactId> <DERSE> $ {com.mybatis.mybatis.version} </-version> </dependency> <dependency> <proupId> org.mybatis </roupherid> <Ertifactid> Mybatis-Spring </ artifactid> <version> $ {com.mybatis.mybatis_spring.version} </ version> </Dependency> <! - 2.servlet web -> <dependency> <proupId> jstl </proupId> </ptefactId> jstl </ artifactId> <Dedersy> <GroupId> javax.servlet </proupId> <Artifactid> javax.servlet-api </retifactid> <version> $ {javax.servlet.version} </-version> </pedency> <! - 3.spring -> <! - 1) Spring Core -> <Dedency> <proupId> ORG.SPRINGFRAM <ArtefactId> printemps-core </ artifactid> <in version> $ {org.springframework.version} </-version> </dependency> <dependency> <proupId> org.springframework </proupId> <Artefactid> Spring-Beans </ artifactid> </prequence> $ {Org.springFrameworkwork.Version} </ version> </dEDSPRENCED> <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> <proupId> org.springframework </proupId> <ArtifActid> printemps-tx </ artifactid> <wredency> $ {org.springframework.version} </preedenc <GroupId> org.springframework </proncId> <Artifactid> printemps-web </artifactid> <in version> $ {org.springframework.version} </-version> </pedency> <Dedency> <proupId> org.springframework </proupId> <Artifactid> printemps-webmvc </tifactId> <version> $ {org.springframework.version} </-version> </dependency> <dependency> <proupId> org.springframework </proupId> <ArtifActid> printemps-test </ artifactid> <version> $ {org.springframework.Version} </preentency> <! - Entrée JSON -> <dedence> <GroupId> org.codehaus.jackson </prôdId> <Artifactid> Jackson-Mapper-Asl </ ArtifactId> <De version> $ {Jackson-Mapper-Asl.Version} </ Version> </Dedency> <Dedency> <ProupId> com.fasterxml.jackson.core </roulid> <artifactid> jackson-Core </ Artifact> <version> $ {jackson.version} </ version> </ dépendance> <dependency> <proupId> com.fasterxml.jackson.core </prouverid> <Artifactid> jackson-databind </ptefactid> <version> $ {jackson.version} </-version> </Dedency> <! - Ajouter Fastjson -> <Dedency> <ArtefactId> FastJSON </ ArfactId> <Sease> $ {FastJSon.Version} </DERNIFRIENT> </DENDENCENCE> </DENDENCESS> <DUIGME> <FINALNAME> LibrarySystem02 </inalName> <GluginManagement> <! - Verrouiller les versions des plugins pour éviter d'utiliser Maven Daufts (peut être déplacé vers PaM-Pom) -> <Glugins> <ArtefactId> Maven-Clean-Plugin </ ArfactId> <Dersion> 3.0.0 </ Version> </ Plugin> <! - Voir http://maven.apache.org/ref/current/maven-core/default-binding <ArtefactId> Maven-Resources-Plugin </ ArfactId> <Dersion> 3.0.2 </ Version> </Glugin> <Glugin> <ArtifActid> Maven-Compiler-Plugin </ Artifactid> <version> 3.7.0 </ Version> </Glugin> </ Plufactid> <Artifactive> Maven-Surefire-Plugin </ Plufactid> <version> 2.20.1 </ version> </ plugin> <glugin> <lefactive> maven-war-Plugin </ artifactid> <version> 3.2.0 </ version> </glugin> <plugin> <lefactive> maven-install-plagin </ artifactid> <version> 2.5.2 </De version> </Glun> </glugin> <ArtefactId> Maven-Deploy-Plugin </ Artifactid> <Dersion> 2.8.2 </DERNIFRIGATION> </GLUGIN> <! - Ingénierie Mybatis-Generator -> <Glugin> <ProupID> org.mybatis.Generator </proncId> <Artifactid> Mybatis-Generator-Maven-Plugin </tifactive> <version> $ {org.mybatis.generator.version} </-version> <filony> <erwerbose> true </ verbose> <cventwrite> true </verswrite> </finigguration> <Dendecces> <Dedency> <proupId> org.mybatis </proupId> <Artifactid> Mybatis </ artifactid> <version> $ {com.mybatis.mybatis.version} </ version> </ dépendance> <dependency> <proupId> MySql </proupId> <Degelfactid> MySQL-Connector-Java </letecticy> </Deradencies> MySQL.Version} </Deroward> </dependency> </Dependences> </ pluginManagement> </ build> </ project>Étape 2: Ajouter une base de données
Ici, vous devez créer une base de données appelée: bibliothèque
L'énoncé de création de table est le suivant:
# Hôte: LocalHost (version 6.0.11-alpha-communauté) # Date: 2018-05-22 20:31:40 # Générateur: MySQL-FRONT 6.0 (Build 2.20) # # Structure pour la table "Book" # Drop Table If existe `Book`; Créer la table `book` (` id` bigint (20) pas null auto_increment, `book_name` varchar (255) pas null,` book_writer` varchar (255) pas null, `book_publisher` varchar (255) non null,` book_isrent` ne null, pas null, `book_ponde` (`id`)) moteur = innodb auto_increment = 5 charse par défaut = utf8; # Données pour la table "Book" # Insérer dans les valeurs de «livre» (1, «Machine Learning», «Zhou Zhihua», «Tsinghua University Press», 1, «Linyue»), (2, `` Practical Machine Learning »,` `People '' Appuyez sur ', 0,' '); # # Structure pour la table "utilisateur" # Drop Table Si existe `` User`; Créer une table `User` (` id` bigint (11) pas null auto_increment, `user_name` varchar (40) pas null,` user_email` varchar (50) pas null, `user_pwd` varchar (50) pas null, clés primaire (` id`)) moteur = innodb auto_incmenment = 11 par défaut Charset = utf8; # Données pour la table "utilisateur" # insérer dans les valeurs «utilisateur» (1, 'Linyue', '[email protected]', '123'), (3, 'Rain', '[email protected]', '222'), (4, 'Ray', '[email protected]', '333'), (5, 'test', '[email protected]', '123');
Téléchargez la démo complète du projet: LibrarySystem02
Ce qui précède est tout le contenu de cet article. J'espère que cela sera utile à l'apprentissage de tous et j'espère que tout le monde soutiendra davantage Wulin.com.