當(dāng)前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
实战_01_Spring SpringMVC 整合Mybaits
生活随笔
收集整理的這篇文章主要介紹了
实战_01_Spring SpringMVC 整合Mybaits
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
文章目錄
- 一、技術(shù)選型
- 1.1. maven坐標(biāo)說明
- 1.2. 環(huán)境準備
- 二、工程所屬關(guān)系
- 2.1. 項目結(jié)構(gòu)總覽
- 2.2. 工程所屬關(guān)系總覽
- 三、創(chuàng)建聚合工程
- 3.1. 聚合工程_ly-parent
- 3.2. 聚合工程_ly-manager
- 四、創(chuàng)建子項目
- 4.1 創(chuàng)建子工程服務(wù)ly-common
- 4.2 創(chuàng)建子工程服務(wù)ly-entity
- 4.3 創(chuàng)建子工程服務(wù)ly-dao
- 4.4 創(chuàng)建子工程服務(wù)ly-interface
- 4.5 創(chuàng)建子工程服務(wù)ly-service
- 4.6 創(chuàng)建子工程服務(wù)ly-web
- 五、工程改進
- 5.1 聚合工程ly-parent
- 5.1.1. 復(fù)制pom依賴
- 5.1.2. 修改打包方式
- 5.1.3. 刪除src目錄
- 5.2. ly-manager改進
- 5.2.1. 復(fù)制pom依賴
- 5.2.2. 調(diào)整打包方式
- 5.2.3. 刪除src目錄
- 5.3. ly-common改進
- 5.3.1. 復(fù)制pom依賴
- 5.3.2. 調(diào)整打包方式
- 5.4. ly-entity 改進
- 5.4.1. 復(fù)制pom依賴
- 5.4.2. 調(diào)整打包方式
- 5.5. ly-dao 改進
- 5.5.1. 復(fù)制pom依賴
- 5.5.2. 調(diào)整打包方式
- 5.6. ly-interface 改進
- 5.6.1. 復(fù)制pom依賴
- 5.6.2. 調(diào)整打包方式
- 5.7. ly-service 改進
- 5.7.1. 復(fù)制pom依賴
- 5.7.2. 調(diào)整打包方式
- 5.8. ly-web 改進
- 5.8.1. 復(fù)制pom依賴
- 5.8.2. 調(diào)整打包方式
- 5.9. ly-web 改進web.xml
- 5.10. 修改index.jsp
- 六、啟動工程
- 6.1. 配置tomcat插件
- 6.2. 查看tomcat7插件
- 6.3. 重新編譯/安裝
- 6.4. 雙擊tomcat7:run
- 6.5. 瀏覽器驗證
一、技術(shù)選型
1.1. maven坐標(biāo)說明
| ArtifactID | 是項目組織唯一的標(biāo)識符,實際對應(yīng)JAVA的包的結(jié)構(gòu),是main目錄里java的目錄結(jié)構(gòu) |
1.2. 環(huán)境準備
| maven | 3.6.1 |
| 服務(wù)器 | tomcat7插件 |
| 開發(fā)工具 | IntelliJ IDEA 2019.1 |
二、工程所屬關(guān)系
2.1. 項目結(jié)構(gòu)總覽
ly-parent :父工程,打包方式pom,管理jar包的版本號,項目中所有工程都應(yīng)該繼承父工程|______ly-common :通用的工具類和枚舉類|______ly-manager :服務(wù)層工程,聚合工程,Pom工程|______ly-entity :實體類|______ly-dao :接口|______ly-interface :服務(wù)接口|______ly-service :邏輯處理層|______ly-web :表現(xiàn)層工程,打包方式war2.2. 工程所屬關(guān)系總覽
| ly-parent | 統(tǒng)一的依賴管理 | pom | 聚合工程 |
| ly-manager | 統(tǒng)一的依賴管理 | pom | 聚合工程 |
| ly-common | 枚舉和工具類 | jar | 子工程 |
| ly-entity | 實體類 | jar | 子工程 |
| ly-dao | mapper接口 | jar | 子工程 |
| ly-interface | 服務(wù)接口 | jar | 子工程 |
| ly-service | 邏輯處理層 | jar | 子工程 |
| ly-web | 表現(xiàn)層工程 | war | 子工程 |
三、創(chuàng)建聚合工程
3.1. 聚合工程_ly-parent
3.2. 聚合工程_ly-manager
- 在ly-parent項目,右擊【new】-【modular】
四、創(chuàng)建子項目
- 這4個子項目打包方式都是jar,創(chuàng)建方式一樣
| ly-common | jar |
| ly-entity | jar |
| ly-dao | jar |
| ly-interface | jar |
| ly-service | jar |
4.1 創(chuàng)建子工程服務(wù)ly-common
- 在ly-parent項目,右擊【new】-【modular】
4.2 創(chuàng)建子工程服務(wù)ly-entity
- 在ly-manager項目,右擊【new】-【modular】
4.3 創(chuàng)建子工程服務(wù)ly-dao
- 在ly-manager項目,右擊【new】-【modular】
4.4 創(chuàng)建子工程服務(wù)ly-interface
- 在ly-manager項目,右擊【new】-【modular】
4.5 創(chuàng)建子工程服務(wù)ly-service
- 在ly-manager項目,右擊【new】-【modular】
4.6 創(chuàng)建子工程服務(wù)ly-web
- 在ly-manager項目,右擊【new】-【modular】
- 這個子項目打包方式都是war
| ly-web | war |
- 工程總覽:
五、工程改進
5.1 聚合工程ly-parent
5.1.1. 復(fù)制pom依賴
<?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.gblfy</groupId><artifactId>ly-parent</artifactId><packaging>pom</packaging><version>0.0.1-SNAPSHOT</version><!--子工程--><modules><!--通用工具類和枚舉--><module>ly-common</module><!--商品模塊 指項目的某一個模塊--><module>ly-manager</module></modules><!--項目名稱--><name>ly-parent</name><!--學(xué)習(xí)更多微服務(wù)請訪問--><url>http://www.gblfy.com</url><properties><!--編碼設(shè)置--><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><!--編譯版本--><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><!-- 集中定義依賴版本號 --><junit.version>4.12</junit.version><spring.version>4.2.4.RELEASE</spring.version><mybatis.version>3.2.8</mybatis.version><mybatis.spring.version>1.2.2</mybatis.spring.version><mybatis.paginator.version>1.2.15</mybatis.paginator.version><mysql.version>5.1.32</mysql.version><slf4j.version>1.6.4</slf4j.version><jackson.version>2.4.2</jackson.version><druid.version>1.0.9</druid.version><httpclient.version>4.3.5</httpclient.version><jstl.version>1.2</jstl.version><servlet-api.version>2.5</servlet-api.version><jsp-api.version>2.0</jsp-api.version><commons-lang3.version>3.3.2</commons-lang3.version><commons-io.version>1.3.2</commons-io.version><commons-net.version>3.3</commons-net.version><pagehelper.version>3.4.2-fix</pagehelper.version><jsqlparser.version>0.9.1</jsqlparser.version><commons-fileupload.version>1.3.1</commons-fileupload.version><jedis.version>2.7.2</jedis.version><solrj.version>4.10.3</solrj.version><dubbo.version>2.5.3</dubbo.version><zookeeper.version>3.4.7</zookeeper.version><zkclient.version>0.1</zkclient.version><activemq.version>5.11.2</activemq.version><freemarker.version>2.3.23</freemarker.version><quartz.version>2.2.2</quartz.version></properties><dependencyManagement><dependencies><!-- Apache工具組件 --><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>${commons-lang3.version}</version></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-io</artifactId><version>${commons-io.version}</version></dependency><dependency><groupId>commons-net</groupId><artifactId>commons-net</artifactId><version>${commons-net.version}</version></dependency><!-- Jackson Json處理工具包 --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>${jackson.version}</version></dependency><!-- httpclient --><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>${httpclient.version}</version></dependency><!-- quartz任務(wù)調(diào)度框架 --><dependency><groupId>org.quartz-scheduler</groupId><artifactId>quartz</artifactId><version>${quartz.version}</version></dependency><!-- 單元測試 --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>${junit.version}</version><scope>test</scope></dependency><!-- 日志處理 --><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>${slf4j.version}</version></dependency><!-- Mybatis --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>${mybatis.version}</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>${mybatis.spring.version}</version></dependency><dependency><groupId>com.github.miemiedev</groupId><artifactId>mybatis-paginator</artifactId><version>${mybatis.paginator.version}</version></dependency><dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper</artifactId><version>${pagehelper.version}</version></dependency><!-- MySql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.version}</version></dependency><!-- 連接池 --><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>${druid.version}</version></dependency><!-- Spring --><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>${spring.version}</version></dependency><!-- JSP相關(guān) --><dependency><groupId>jstl</groupId><artifactId>jstl</artifactId><version>${jstl.version}</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>${servlet-api.version}</version><scope>provided</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jsp-api</artifactId><version>${jsp-api.version}</version><scope>provided</scope></dependency><!-- 文件上傳組件 --><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>${commons-fileupload.version}</version></dependency><!-- Redis客戶端 --><dependency><groupId>redis.clients</groupId><artifactId>jedis</artifactId><version>${jedis.version}</version></dependency><!-- solr客戶端 --><dependency><groupId>org.apache.solr</groupId><artifactId>solr-solrj</artifactId><version>${solrj.version}</version></dependency><!-- dubbo相關(guān) --><dependency><groupId>com.alibaba</groupId><artifactId>dubbo</artifactId><version>${dubbo.version}</version></dependency><dependency><groupId>org.apache.zookeeper</groupId><artifactId>zookeeper</artifactId><version>${zookeeper.version}</version></dependency><dependency><groupId>com.github.sgroschupf</groupId><artifactId>zkclient</artifactId><version>${zkclient.version}</version></dependency><dependency><groupId>org.apache.activemq</groupId><artifactId>activemq-all</artifactId><version>${activemq.version}</version></dependency><dependency><groupId>org.freemarker</groupId><artifactId>freemarker</artifactId><version>${freemarker.version}</version></dependency></dependencies></dependencyManagement><build><finalName>${project.artifactId}</finalName><plugins><!-- 資源文件拷貝插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>2.7</version><configuration><encoding>UTF-8</encoding></configuration></plugin><!-- java編譯插件 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.2</version><configuration><source>1.7</source><target>1.7</target><encoding>UTF-8</encoding></configuration></plugin></plugins><pluginManagement><plugins><!-- 配置Tomcat插件 --><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version></plugin></plugins></pluginManagement></build></project>5.1.2. 修改打包方式
<!--標(biāo)志父工程--><packaging>pom</packaging>5.1.3. 刪除src目錄
略
5.2. ly-manager改進
5.2.1. 復(fù)制pom依賴
<?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"><parent><groupId>com.gblfy</groupId><artifactId>ly-parent</artifactId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!--組織項目唯一標(biāo)識--><artifactId>ly-manager</artifactId><!--打包方式--><packaging>pom</packaging><!--項目名稱--><name>ly-manager</name><!--學(xué)習(xí)更多微服務(wù)請訪問--><url>http://www.gblfy.com</url><!--子工程--><modules><!--實體類--><module>ly-entity</module><!--數(shù)據(jù)交互接口--><module>ly-dao</module><!--調(diào)用服務(wù)接口--><module>ly-interface</module><!--邏輯處理--><module>ly-service</module><!--web客戶端--><module>ly-web</module></modules><dependencies><!--工具類--><dependency><groupId>com.gblfy</groupId><artifactId>ly-common</artifactId><version>0.0.1-SNAPSHOT</version></dependency></dependencies></project>5.2.2. 調(diào)整打包方式
<!--打包方式--><packaging>jar</packaging>5.2.3. 刪除src目錄
略
5.3. ly-common改進
5.3.1. 復(fù)制pom依賴
<?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"><parent><groupId>com.gblfy</groupId><artifactId>ly-parent</artifactId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!--組織項目唯一標(biāo)識--><artifactId>ly-common</artifactId><!--打包方式--><packaging>jar</packaging><!--項目名稱--><name>ly-common</name><!--學(xué)習(xí)更多微服務(wù)請訪問--><url>http://www.gblfy.com</url><dependencies><!-- Apache工具組件 --><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-io</artifactId></dependency><dependency><groupId>commons-net</groupId><artifactId>commons-net</artifactId></dependency><!-- Jackson Json處理工具包 --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId></dependency><!-- httpclient --><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId></dependency><!-- 單元測試 --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><scope>test</scope></dependency><!-- 日志處理 --><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></dependency></dependencies></project>5.3.2. 調(diào)整打包方式
<!--打包方式--><packaging>jar</packaging>5.4. ly-entity 改進
5.4.1. 復(fù)制pom依賴
<?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"><parent><artifactId>ly-manager</artifactId><groupId>com.gblfy</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!--組織項目唯一標(biāo)識--><artifactId>ly-entity</artifactId><!--打包方式--><packaging>jar</packaging><!--項目名稱--><name>ly-entity</name><!--學(xué)習(xí)更多微服務(wù)請訪問--><url>http://www.gblfy.com</url></project>5.4.2. 調(diào)整打包方式
<!--打包方式--><packaging>jar</packaging>5.5. ly-dao 改進
5.5.1. 復(fù)制pom依賴
<?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"><parent><groupId>com.gblfy</groupId><artifactId>ly-manager</artifactId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!--組織項目唯一標(biāo)識--><artifactId>ly-dao</artifactId><!--打包方式--><packaging>jar</packaging><!--項目名稱--><name>ly-dao</name><!--學(xué)習(xí)更多微服務(wù)請訪問--><url>http://www.gblfy.com</url><dependencies><!--實體類--><dependency><groupId>com.gblfy</groupId><artifactId>ly-entity</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!-- 添加對mybatis的依賴 --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId></dependency><dependency><groupId>com.github.miemiedev</groupId><artifactId>mybatis-paginator</artifactId></dependency><dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper</artifactId></dependency><!-- MySql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!-- 連接池 --><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId></dependency></dependencies></project>5.5.2. 調(diào)整打包方式
<!--打包方式--><packaging>jar</packaging>5.6. ly-interface 改進
5.6.1. 復(fù)制pom依賴
<?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"><parent><groupId>com.gblfy</groupId><artifactId>ly-manager</artifactId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!--組織項目唯一標(biāo)識--><artifactId>ly-interface</artifactId><!--打包方式--><packaging>jar</packaging><!--項目名稱--><name>ly-interface</name><!--學(xué)習(xí)更多微服務(wù)請訪問--><url>http://www.gblfy.com</url><dependencies><!--實體類--><dependency><groupId>com.gblfy</groupId><artifactId>ly-entity</artifactId><version>0.0.1-SNAPSHOT</version></dependency></dependencies> </project>5.6.2. 調(diào)整打包方式
<!--打包方式--><packaging>jar</packaging>5.7. ly-service 改進
5.7.1. 復(fù)制pom依賴
<?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"><parent><artifactId>ly-manager</artifactId><groupId>com.gblfy</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!--組織項目唯一標(biāo)識--><artifactId>ly-service</artifactId><!--打包方式--><packaging>jar</packaging><!--項目名稱--><name>ly-service</name><!--學(xué)習(xí)更多微服務(wù)請訪問--><url>http://www.gblfy.com</url><dependencies><!--數(shù)據(jù)交互接口--><dependency><groupId>com.gblfy</groupId><artifactId>ly-dao</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!--調(diào)用服務(wù)接口--><dependency><groupId>com.gblfy</groupId><artifactId>ly-interface</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!-- spring的依賴 --><!-- Spring --><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jms</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId></dependency></dependencies><build><pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --><plugins><!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --><plugin><artifactId>maven-clean-plugin</artifactId><version>3.1.0</version></plugin><!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --><plugin><artifactId>maven-resources-plugin</artifactId><version>3.0.2</version></plugin><plugin><artifactId>maven-compiler-plugin</artifactId><version>3.8.0</version></plugin><plugin><artifactId>maven-surefire-plugin</artifactId><version>2.22.1</version></plugin><plugin><artifactId>maven-jar-plugin</artifactId><version>3.0.2</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><!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --><plugin><artifactId>maven-site-plugin</artifactId><version>3.7.1</version></plugin><plugin><artifactId>maven-project-info-reports-plugin</artifactId><version>3.0.0</version></plugin></plugins></pluginManagement></build> </project>5.7.2. 調(diào)整打包方式
<!--打包方式--><packaging>jar</packaging>5.8. ly-web 改進
5.8.1. 復(fù)制pom依賴
<?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"><parent><artifactId>ly-manager</artifactId><groupId>com.gblfy</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!--組織項目唯一標(biāo)識--><artifactId>ly-web</artifactId><!--打包方式--><packaging>war</packaging><!--項目名稱--><name>ly-web</name><!--學(xué)習(xí)更多微服務(wù)請訪問--><url>http://www.gblfy.com</url><dependencies><!--服務(wù)層--><dependency><groupId>com.gblfy</groupId><artifactId>ly-service</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!-- JSP相關(guān) --><dependency><groupId>jstl</groupId><artifactId>jstl</artifactId></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><scope>provided</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jsp-api</artifactId><scope>provided</scope></dependency></dependencies></project>5.8.2. 調(diào)整打包方式
<!--打包方式--><packaging>war</packaging>5.9. ly-web 改進web.xml
<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app><!--web項目名稱--><display-name>ly-web</display-name><!--歡迎頁面--><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>5.10. 修改index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%> <html> <head><title>gblfy技術(shù)交流社區(qū)</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <h3>學(xué)習(xí)更多微服技術(shù)知識務(wù)請訪問 <a href="https://www.gblfy.com">gblfy技術(shù)交流社區(qū)</a></h3> </body> </html>六、啟動工程
6.1. 配置tomcat插件
- 需要在ly-manager 的pom工程中,配置tomcat插件。啟動的端口號,和工程名稱
6.2. 查看tomcat7插件
6.3. 重新編譯/安裝
- 執(zhí)行以下命令即可
- 效果圖:
6.4. 雙擊tomcat7:run
6.5. 瀏覽器驗證
http://localhost:8080/到此,所需依賴已經(jīng)整合完成,工程搭建完成!!!
接下一篇:企業(yè)實戰(zhàn)_02_Spring SpringMVC 整合Mybaits
https://blog.csdn.net/weixin_40816738/article/details/101356112
總結(jié)
以上是生活随笔為你收集整理的实战_01_Spring SpringMVC 整合Mybaits的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: EditPlus连接远程Linux虚拟机
- 下一篇: Jenkins进阶系列之——07更改Je