最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用springMVC所需要的pom配置

 更新時(shí)間:2021年09月14日 16:42:42   作者:羽笑  
這篇文章主要介紹了使用springMVC所需要的pom配置,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

springMVC所需要的pom配置

配置應(yīng)用的字符編碼格式

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>

servlet api的maven依賴

<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>javax.servlet-api</artifactId>
   <version>3.1.0</version>
   <scope>provided</scope>
</dependency>

javaservlet page api(jsp api)的maven依賴

<dependency>
   <groupId>javax.servlet.jsp</groupId>
   <artifactId>javax.servlet.jsp-api</artifactId>
   <version>2.3.1</version>
   <scope>provided</scope>
</dependency>

jstl的maven依賴

<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>jstl</artifactId>
   <version>1.2</version>
</dependency>

spring-webmvc的maven依賴

<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-webmvc</artifactId>
   <version>5.1.0.RELEASE</version>
</dependency>

commons-lang3的依賴

<dependency>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-lang3</artifactId>
   <version>3.8.1</version>
</dependency>

hibernate-validator

<dependency>
   <groupId>org.hibernate.validator</groupId>
   <artifactId>hibernate-validator</artifactId>
   <version>6.0.13.Final</version>
</dependency>

應(yīng)用版本跟jetty配置

<build>
  <plugins>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
     <source>1.8</source>
     <target>1.8</target>
    </configuration>
   </plugin>
   <plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.3.7.v20160115</version>
    <configuration>
     <webApp>
      <contextPath>/test</contextPath>
     </webApp>
     <scanIntervalSeconds>10</scanIntervalSeconds>
    </configuration>
   </plugin>
  </plugins>
 </build>

springMVC pom依賴及配置文件

Spring MVC pom依賴

<dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.1.19.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.2</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.18</version>
        </dependency>
  
          <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.11.0</version>
        </dependency>
  
    </dependencies>

application.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       https://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       https://www.springframework.org/schema/mvc/spring-mvc.xsd">
    <!-- 自動(dòng)掃描指定的包,下面所有注解類交給IOC容器管理 -->
    <context:component-scan base-package="controller"/>
    <!--靜態(tài)資源過濾-->
    <mvc:default-servlet-handler />
    <!--JSON亂碼問題配置-->
    <mvc:annotation-driven>
        <mvc:message-converters register-defaults="true">
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <constructor-arg value="UTF-8"/>
            </bean>
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="objectMapper">
                    <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean">
                        <property name="failOnEmptyBeans" value="false"/>
                    </bean>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>
    <!-- 視圖解析器 -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          id="internalResourceViewResolver">
        <!-- 前綴 -->
        <property name="prefix" value="/WEB-INF/jsp/" />
        <!-- 后綴 -->
        <property name="suffix" value=".jsp" />
    </bean>
</beans>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    <servlet>
        <servlet-name>springmvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:application.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>springmvc</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
<!--    亂碼過濾器-->
    <filter>
        <filter-name>encoding</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>utf-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>encoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>    
</web-app>

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Java編程在ICPC快速IO實(shí)現(xiàn)源碼

    Java編程在ICPC快速IO實(shí)現(xiàn)源碼

    這篇文章主要介紹了Java Fast IO in ICPC實(shí)現(xiàn)源碼,具有一定參考價(jià)值,需要的朋友可以了解下。
    2017-09-09
  • SpringBoot自定義動(dòng)態(tài)數(shù)據(jù)源的流程步驟

    SpringBoot自定義動(dòng)態(tài)數(shù)據(jù)源的流程步驟

    動(dòng)態(tài)數(shù)據(jù)源,本質(zhì)上是把多個(gè)數(shù)據(jù)源存儲(chǔ)在一個(gè)?Map?中,當(dāng)需要使用某一個(gè)數(shù)據(jù)源時(shí),使用?key?獲取指定數(shù)據(jù)源進(jìn)行處理,本文將給大家介紹一下SpringBoot自定義動(dòng)態(tài)數(shù)據(jù)源的流程步驟,需要的朋友可以參考下
    2024-06-06
  • Socket結(jié)合線程池使用實(shí)現(xiàn)客戶端和服務(wù)端通信demo

    Socket結(jié)合線程池使用實(shí)現(xiàn)客戶端和服務(wù)端通信demo

    這篇文章主要為大家介紹了Socket結(jié)合線程池的使用來實(shí)現(xiàn)客戶端和服務(wù)端通信實(shí)戰(zhàn)demo,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步
    2022-03-03
  • springboot aop添加日志方式

    springboot aop添加日志方式

    這篇文章主要介紹了springboot aop添加日志方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-05-05
  • Spring?Boot?多數(shù)據(jù)源處理事務(wù)的思路詳解

    Spring?Boot?多數(shù)據(jù)源處理事務(wù)的思路詳解

    這篇文章主要介紹了Spring?Boot?多數(shù)據(jù)源如何處理事務(wù),本文單純就是技術(shù)探討,要從實(shí)際應(yīng)用中來說的話,我并不建議這樣去玩分布式事務(wù)、也不建議這樣去玩多數(shù)據(jù)源,畢竟分布式事務(wù)主要還是用在微服務(wù)場(chǎng)景下,對(duì)Spring?Boot?多數(shù)據(jù)源事務(wù)相關(guān)知識(shí)感興趣的朋友參考下本文
    2022-06-06
  • Java 數(shù)據(jù)庫連接(JDBC)的相關(guān)總結(jié)

    Java 數(shù)據(jù)庫連接(JDBC)的相關(guān)總結(jié)

    這篇文章主要介紹了Java 數(shù)據(jù)庫連接(JDBC)的相關(guān)總結(jié),幫助大家更好的理解和學(xué)習(xí)使用Java,感興趣的朋友可以了解下
    2021-03-03
  • Springboot集成Ehcache3實(shí)現(xiàn)本地緩存的配置方法

    Springboot集成Ehcache3實(shí)現(xiàn)本地緩存的配置方法

    EhCache是一個(gè)純Java的進(jìn)程內(nèi)緩存框架,是 Hibernate 中默認(rèn)的 CacheProvider,同Redis一樣,EhCache 不是純內(nèi)存緩存,它支持基于內(nèi)存和磁盤的二級(jí)緩存,本文介紹Springboot集成Ehcache3實(shí)現(xiàn)本地緩存的配置方法,感興趣的朋友一起看看吧
    2024-04-04
  • 如何實(shí)現(xiàn)nohup?java進(jìn)程號(hào)一直在變方法步驟詳解

    如何實(shí)現(xiàn)nohup?java進(jìn)程號(hào)一直在變方法步驟詳解

    這篇文章主要為大家介紹了如何實(shí)現(xiàn)nohup?java進(jìn)程號(hào)一直在變方法步驟詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-11-11
  • java使用多線程找出最大隨機(jī)數(shù)

    java使用多線程找出最大隨機(jī)數(shù)

    這篇文章主要為大家詳細(xì)介紹了java使用多線程找出最大隨機(jī)數(shù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-07-07
  • spring boot與kafka集成的簡(jiǎn)單實(shí)例

    spring boot與kafka集成的簡(jiǎn)單實(shí)例

    本篇文章主要介紹了spring boot與kafka集成的簡(jiǎn)單實(shí)例,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-09-09

最新評(píng)論

通渭县| 宁津县| 永寿县| 南召县| 贺州市| 吉水县| 屯昌县| 四川省| 正安县| 治多县| 临澧县| 庆云县| 丰原市| 嵩明县| 永福县| 神农架林区| 芮城县| 邛崃市| 寿宁县| 台南县| 祥云县| 陇南市| 宜兴市| 梁平县| 汾西县| 淮滨县| 股票| 上虞市| 图片| 岚皋县| 舟山市| 林芝县| 榆中县| 来安县| 芮城县| 左权县| 阿荣旗| 壶关县| 石楼县| 吴桥县| 香港 |