亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Spring MVC的web.xml配置詳解

 更新時(shí)間:2017年06月02日 09:20:17   作者:Liuqz2009  
這篇文章主要介紹了Spring MVC的web.xml配置詳解,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧

spring是目前最流行的框架。創(chuàng)建java web項(xiàng)目時(shí),我們首先會遇到的配置文件就是web.xml,這是javaweb為我們封裝的邏輯,不在今天的研究中。下面我們將簡單講講web.xml中的配置。

一、一個(gè)空的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  id="WebApp_ID">
</web-app>

二、標(biāo)簽介紹

web.xml中比較常見的標(biāo)簽以及其加載順序?yàn)椋?/p>

context-param > listener > filter > servlet

1、 <display-name>Archetype Created Web Application</display-name>

display-name 是標(biāo)識項(xiàng)目的名稱,這個(gè)不是很常用,可有可無的,或者說不需要我們?nèi)ピ谝獾臇|西。

2、 <context-param>

<context-param>
  <param-name>webAppRootKey</param-name>
  <param-value>60000</param-value>
</context-param>

context-param 是web.xml首先加載的標(biāo)簽,其下子標(biāo)簽有param-name和param-value.

此所設(shè)定的參數(shù),在JSP網(wǎng)頁中可以使用下列方法來取得:

${initParam.webAppRootKey}

若在Servlet可以使用下列方法來獲得:

復(fù)制代碼 代碼如下:

String param_name=getServletContext().getInitParamter(“webAppRootKey”);

3、listener

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>

listenter在項(xiàng)目開始的時(shí)候就注入進(jìn)來,盡在context-param之后,所以正常我們將spring配置在listener 中,這樣方法spring 初始化相關(guān)的bean。

4、filter

<filter>
    <filter-name>CharacterEncodingFilter</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>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>CharacterEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

filter起到一個(gè)過濾的作用,在servlet執(zhí)行前后,像上面的配置就是在過濾servlet前將編碼轉(zhuǎn)換UTF-8,filter-mapping 則是將filter和url路徑進(jìn)行映射。其中init-param則是將初始化需要的參數(shù)傳入到filter-class中從而進(jìn)行初始化。filter和filter-mapping中的name必須是相同的,才能起到映射的作用,而filter-mapping 中的url-pattern則是匹配請求路徑的。上面‘/*'表示過濾所有請求的servlet,如果寫成‘/zxh',則過濾http://localhost:8080/項(xiàng)目名/zxh這個(gè)請求。

5、servlet

  <servlet> 
    <!-- 配置DispatcherServlet --> 
    <servlet-name>springMvc</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
      <!-- 指定spring mvc配置文件位置 不指定使用默認(rèn)情況 --> 
      <init-param>   
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/spring-mvc.xml</param-value>
      </init-param> 
    <!-- 設(shè)置啟動順序 --> 
    <load-on-startup>1</load-on-startup> 
  </servlet>

  <!-- ServLet 匹配映射 -->
  <servlet-mapping>
    <servlet-name>springMvc</servlet-name>
    <url-pattern>*.zxh</url-pattern>
  </servlet-mapping>

servlet和filter類似,需要先指定servlet對應(yīng)的class類,然后將這個(gè)類和utl路徑請求地址進(jìn)行映射。這里不多說了。

以上就是web.xml文件中出現(xiàn)最多的幾個(gè)標(biāo)簽。其他的比如:

6、歡迎頁

<welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>

7、錯(cuò)誤頁

  <!-- 后臺程序異常錯(cuò)誤跳轉(zhuǎn)頁面 -->
  <error-page> 
    <exception-type>java.lang.Throwable</exception-type> 
    <location>/views/error.jsp</location> 
  </error-page> 

  <!-- 500跳轉(zhuǎn)頁面-->
  <error-page> 
    <error-code>500</error-code> 
    <location>/views/500.jsp</location> 
  </error-page> 

  <!-- 404跳轉(zhuǎn)頁面 -->
  <error-page> 
    <error-code>404</error-code> 
    <location>/views/404.jsp</location> 
  </error-page>

三、示例

1、spring 框架解決字符串編碼問題:過濾器 CharacterEncodingFilter(filter-name)

2、在web.xml配置監(jiān)聽器ContextLoaderListener(listener-class)
ContextLoaderListener的作用就是啟動Web容器時(shí),自動裝配ApplicationContext的配置信息。因?yàn)樗鼘?shí)現(xiàn)了ServletContextListener這個(gè)接口,在web.xml配置這個(gè)監(jiān)聽器,啟動容器時(shí),就會默認(rèn)執(zhí)行它實(shí)現(xiàn)的方法。

3、部署applicationContext的xml文件:contextConfigLocation(context-param下的param-name)

4、DispatcherServlet是前置控制器,配置在web.xml文件中的。攔截匹配的請求,Servlet攔截匹配規(guī)則要自已定義,把攔截下來的請求,依據(jù)某某規(guī)則分發(fā)到目標(biāo)Controller(我們寫的Action)來處理。

DispatcherServlet(servlet-name、servlet-class、init-param、param-name(contextConfigLocation)、param-value)
在DispatcherServlet的初始化過程中,框架會在web應(yīng)用的 WEB-INF文件夾下尋找名為[servlet-name]-servlet.xml 的配置文件,生成文件中定義的bean

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 

  <!-- 在Spring框架中是如何解決從頁面?zhèn)鱽淼淖址木幋a問題的呢?
  下面我們來看看Spring框架給我們提供過濾器CharacterEncodingFilter 
   這個(gè)過濾器就是針對于每次瀏覽器請求進(jìn)行過濾的,然后再其之上添加了父類沒有的功能即處理字符編碼。 
   其中encoding用來設(shè)置編碼格式,forceEncoding用來設(shè)置是否理會 request.getCharacterEncoding()方法,設(shè)置為true則強(qiáng)制覆蓋之前的編碼格式。--> 
  <filter> 
    <filter-name>characterEncodingFilter</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> 
    <init-param> 
      <param-name>forceEncoding</param-name> 
      <param-value>true</param-value> 
    </init-param> 
  </filter> 
  <filter-mapping> 
    <filter-name>characterEncodingFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
  </filter-mapping> 
  <!-- 項(xiàng)目中使用Spring 時(shí),applicationContext.xml配置文件中并沒有BeanFactory,要想在業(yè)務(wù)層中的class 文件中直接引用Spring容器管理的bean可通過以下方式--> 
  <!--1、在web.xml配置監(jiān)聽器ContextLoaderListener--> 
  <!--ContextLoaderListener的作用就是啟動Web容器時(shí),自動裝配ApplicationContext的配置信息。因?yàn)樗鼘?shí)現(xiàn)了ServletContextListener這個(gè)接口,在web.xml配置這個(gè)監(jiān)聽器,啟動容器時(shí),就會默認(rèn)執(zhí)行它實(shí)現(xiàn)的方法。 
  在ContextLoaderListener中關(guān)聯(lián)了ContextLoader這個(gè)類,所以整個(gè)加載配置過程由ContextLoader來完成。 
  它的API說明 
  第一段說明ContextLoader可以由 ContextLoaderListener和ContextLoaderServlet生成。 
  如果查看ContextLoaderServlet的API,可以看到它也關(guān)聯(lián)了ContextLoader這個(gè)類而且它實(shí)現(xiàn)了HttpServlet這個(gè)接口 
  第二段,ContextLoader創(chuàng)建的是 XmlWebApplicationContext這樣一個(gè)類,它實(shí)現(xiàn)的接口是WebApplicationContext->ConfigurableWebApplicationContext->ApplicationContext-> 
  BeanFactory這樣一來spring中的所有bean都由這個(gè)類來創(chuàng)建 
   IUploaddatafileManager uploadmanager = (IUploaddatafileManager)  ContextLoaderListener.getCurrentWebApplicationContext().getBean("uploadManager");
   --> 
  <listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
  </listener> 
  <!--2、部署applicationContext的xml文件--> 
  <!--如果在web.xml中不寫任何參數(shù)配置信息,默認(rèn)的路徑是"/WEB-INF/applicationContext.xml, 
  在WEB-INF目錄下創(chuàng)建的xml文件的名稱必須是applicationContext.xml。 
  如果是要自定義文件名可以在web.xml里加入contextConfigLocation這個(gè)context參數(shù): 
  在<param-value> </param-value>里指定相應(yīng)的xml文件名,如果有多個(gè)xml文件,可以寫在一起并以“,”號分隔。 
  也可以這樣applicationContext-*.xml采用通配符,比如這那個(gè)目錄下有applicationContext-ibatis-base.xml, 
  applicationContext-action.xml,applicationContext-ibatis-dao.xml等文件,都會一同被載入。 
  在ContextLoaderListener中關(guān)聯(lián)了ContextLoader這個(gè)類,所以整個(gè)加載配置過程由ContextLoader來完成。--> 
  <context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>classpath:spring/applicationContext.xml</param-value> 
  </context-param> 

  <!--如果你的DispatcherServlet攔截"/",為了實(shí)現(xiàn)REST風(fēng)格,攔截了所有的請求,那么同時(shí)對*.js,*.jpg等靜態(tài)文件的訪問也就被攔截了。--> 
  <!--方案一:激活Tomcat的defaultServlet來處理靜態(tài)文件--> 
  <!--要寫在DispatcherServlet的前面, 讓 defaultServlet先攔截請求,這樣請求就不會進(jìn)入Spring了,我想性能是最好的吧。--> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.css</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.swf</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.gif</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.jpg</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.png</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.js</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.html</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.xml</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.json</url-pattern> 
  </servlet-mapping> 
  <servlet-mapping> 
    <servlet-name>default</servlet-name> 
    <url-pattern>*.map</url-pattern> 
  </servlet-mapping> 
  <!--使用Spring MVC,配置DispatcherServlet是第一步。DispatcherServlet是一個(gè)Servlet,,所以可以配置多個(gè)DispatcherServlet--> 
  <!--DispatcherServlet是前置控制器,配置在web.xml文件中的。攔截匹配的請求,Servlet攔截匹配規(guī)則要自已定義,把攔截下來的請求,依據(jù)某某規(guī)則分發(fā)到目標(biāo)Controller(我們寫的Action)來處理。--> 
  <servlet> 
    <servlet-name>DispatcherServlet</servlet-name><!--在DispatcherServlet的初始化過程中,框架會在web應(yīng)用的 WEB-INF文件夾下尋找名為[servlet-name]-servlet.xml 的配置文件,生成文件中定義的bean。--> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <!--指明了配置文件的文件名,不使用默認(rèn)配置文件名,而使用dispatcher-servlet.xml配置文件。--> 
    <init-param> 
      <param-name>contextConfigLocation</param-name> 
      <!--其中<param-value>**.xml</param-value> 這里可以使用多種寫法--> 
      <!--1、不寫,使用默認(rèn)值:/WEB-INF/<servlet-name>-servlet.xml--> 
      <!--2、<param-value>/WEB-INF/classes/dispatcher-servlet.xml</param-value>--> 
      <!--3、<param-value>classpath*:dispatcher-servlet.xml</param-value>--> 
      <!--4、多個(gè)值用逗號分隔--> 
      <param-value>classpath:spring/dispatcher-servlet.xml</param-value> 
    </init-param> 
    <load-on-startup>1</load-on-startup><!--是啟動順序,讓這個(gè)Servlet隨Servletp容器一起啟動。--> 
  </servlet> 
  <servlet-mapping> 
    <!--這個(gè)Servlet的名字是dispatcher,可以有多個(gè)DispatcherServlet,是通過名字來區(qū)分的。每一個(gè)DispatcherServlet有自己的WebApplicationContext上下文對象。同時(shí)保存的ServletContext中和Request對象中.--> 
    <!--ApplicationContext是Spring的核心,Context我們通常解釋為上下文環(huán)境,我想用“容器”來表述它更容易理解一些,ApplicationContext則是“應(yīng)用的容器”了:P,Spring把Bean放在這個(gè)容器中,在需要的時(shí)候,用getBean方法取出--> 
    <servlet-name>DispatcherServlet</servlet-name> 
    <!--Servlet攔截匹配規(guī)則可以自已定義,當(dāng)映射為@RequestMapping("/user/add")時(shí),為例,攔截哪種URL合適?--> 
    <!--1、攔截*.do、*.htm, 例如:/user/add.do,這是最傳統(tǒng)的方式,最簡單也最實(shí)用。不會導(dǎo)致靜態(tài)文件(jpg,js,css)被攔截。--> 
    <!--2、攔截/,例如:/user/add,可以實(shí)現(xiàn)現(xiàn)在很流行的REST風(fēng)格。很多互聯(lián)網(wǎng)類型的應(yīng)用很喜歡這種風(fēng)格的URL。弊端:會導(dǎo)致靜態(tài)文件(jpg,js,css)被攔截后不能正常顯示。 --> 
    <url-pattern>/</url-pattern> <!--會攔截URL中帶“/”的請求。--> 
  </servlet-mapping> 

  <welcome-file-list><!--指定歡迎頁面--> 
    <welcome-file>login.html</welcome-file> 
  </welcome-file-list> 
  <error-page> <!--當(dāng)系統(tǒng)出現(xiàn)404錯(cuò)誤,跳轉(zhuǎn)到頁面nopage.html--> 
    <error-code>404</error-code> 
    <location>/nopage.html</location> 
  </error-page> 
  <error-page> <!--當(dāng)系統(tǒng)出現(xiàn)java.lang.NullPointerException,跳轉(zhuǎn)到頁面error.html--> 
    <exception-type>java.lang.NullPointerException</exception-type> 
    <location>/error.html</location> 
  </error-page> 
  <session-config><!--會話超時(shí)配置,單位分鐘--> 
    <session-timeout>360</session-timeout> 
  </session-config> 
</web-app>

四、spring加載

通過上面的了解,我們可以看出spring核心配置文件就是listener那塊。在監(jiān)聽之前我們已經(jīng)通過context-param將spring配置文件傳到上下文中了(application)。下面我們就來看看spring是如何工作的吧

第一步:

點(diǎn)開listener源碼,我們發(fā)現(xiàn)他有下面幾個(gè)方法。和繼承的關(guān)系。我們發(fā)現(xiàn)他實(shí)現(xiàn)了ContextLoaderListener這個(gè)接口,這個(gè)接口在參數(shù)設(shè)置好之后自動執(zhí)行contextInitialized方法的。

那么我們來看看contextInitialized方法

public WebApplicationContext initWebApplicationContext(ServletContext servletContext) {
    if (servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE) != null) {
      throw new IllegalStateException(
          "Cannot initialize context because there is already a root application context present - " +
          "check whether you have multiple ContextLoader* definitions in your web.xml!");
    }

    Log logger = LogFactory.getLog(ContextLoader.class);
    servletContext.log("Initializing Spring root WebApplicationContext");
    if (logger.isInfoEnabled()) {
      logger.info("Root WebApplicationContext: initialization started");
    }
    long startTime = System.currentTimeMillis();

    try {
      // Store context in local instance variable, to guarantee that
      // it is available on ServletContext shutdown.
      if (this.context == null) {
        this.context = createWebApplicationContext(servletContext);
      }
      if (this.context instanceof ConfigurableWebApplicationContext) {
        ConfigurableWebApplicationContext cwac = (ConfigurableWebApplicationContext) this.context;
        if (!cwac.isActive()) {
          // The context has not yet been refreshed -> provide services such as
          // setting the parent context, setting the application context id, etc
          if (cwac.getParent() == null) {
            // The context instance was injected without an explicit parent ->
            // determine parent for root web application context, if any.
            ApplicationContext parent = loadParentContext(servletContext);
            cwac.setParent(parent);
          }
          configureAndRefreshWebApplicationContext(cwac, servletContext);
        }
      }
      servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.context);

      ClassLoader ccl = Thread.currentThread().getContextClassLoader();
      if (ccl == ContextLoader.class.getClassLoader()) {
        currentContext = this.context;
      }
      else if (ccl != null) {
        currentContextPerThread.put(ccl, this.context);
      }

      if (logger.isDebugEnabled()) {
        logger.debug("Published root WebApplicationContext as ServletContext attribute with name [" +
            WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE + "]");
      }
      if (logger.isInfoEnabled()) {
        long elapsedTime = System.currentTimeMillis() - startTime;
        logger.info("Root WebApplicationContext: initialization completed in " + elapsedTime + " ms");
      }

      return this.context;
    }
    catch (RuntimeException ex) {
      logger.error("Context initialization failed", ex);
      servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
      throw ex;
    }
    catch (Error err) {
      logger.error("Context initialization failed", err);
      servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, err);
      throw err;
    }
  }

仔細(xì)研究官方解釋,就是在這里初始化application,這里會用到contextClass+contextConfigLocation兩個(gè)參數(shù),如果contextClass在context-param提供了,我們就會根據(jù)這一個(gè)class去初始化application,很顯然我們正常配置都沒有配這個(gè),而是配置了后者,配置了后者就會去根據(jù)contextConfigLocation中提供的配置文件去解析然后創(chuàng)建相關(guān)的bean和application操作,這個(gè)方法的最后會執(zhí)行configureAndRefreshWebApplicationContext方法。這個(gè)方法就是在根據(jù)contextConfigLocation提供的配置文件中創(chuàng)建相關(guān)的bean。

五、springMVC 加載

springMVC其實(shí)和spring是一樣的,但是他不用再程序開始時(shí)訪問

  <servlet> 
    <!-- 配置DispatcherServlet --> 
    <servlet-name>springMvc</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
      <!-- 指定spring mvc配置文件位置 不指定使用默認(rèn)情況 --> 
      <init-param>   
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/spring-mvc.xml</param-value>
      </init-param> 
    <!-- 設(shè)置啟動順序 --> 
    <load-on-startup>1</load-on-startup> 
  </servlet>

  <!-- ServLet 匹配映射 -->
  <servlet-mapping>
    <servlet-name>springMvc</servlet-name>
    <url-pattern>*.zxh</url-pattern>
  </servlet-mapping>

看DispatcherServlet源碼中對contextConfigLocation參數(shù)的解釋

上面明確指出我們這個(gè)參數(shù)給XmlWebApplicationContext類的,我們在進(jìn)入XmlWebApplicationContext類看看究竟。

這樣我們很容易理解為什么springmvc默認(rèn)的配置文件會在WEB-INF/application.xml中的吧。

在dispatcherservlet中有一個(gè)初始化方法,這里就初始化配置中一些東西,比如說文件上傳適配器的配置等等。

protected void initStrategies(ApplicationContext context) {
    initMultipartResolver(context);
    initLocaleResolver(context);
    initThemeResolver(context);
    initHandlerMappings(context);
    initHandlerAdapters(context);
    initHandlerExceptionResolvers(context);
    initRequestToViewNameTranslator(context);
    initViewResolvers(context);
    initFlashMapManager(context);
  }

總結(jié)

spring+springmvc在配置中主要就是上面的兩個(gè)配置,當(dāng)然spring的強(qiáng)大不是我們一兩天能夠研究來的,我上面只是簡單的研究討論了一下。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 關(guān)于SpringBoot禁止循環(huán)依賴解說

    關(guān)于SpringBoot禁止循環(huán)依賴解說

    這篇文章主要介紹了關(guān)于SpringBoot禁止循環(huán)依賴解說,Spring的Bean管理,文章圍繞主題展開詳細(xì)介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下
    2022-05-05
  • SpringBoot配置文件導(dǎo)入方法詳細(xì)講解

    SpringBoot配置文件導(dǎo)入方法詳細(xì)講解

    Spring Boot雖然是Spring的衍生物, 但默認(rèn)情況下Boot是不能直接使用Spring的配置文件的, 我們可以通過兩種方式導(dǎo)入Spring的配置
    2022-10-10
  • 淺談SpringMVC請求映射handler源碼解讀

    淺談SpringMVC請求映射handler源碼解讀

    這篇文章主要介紹了淺談SpringMVC請求映射handler源碼解讀,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • Shiro中session超時(shí)頁面跳轉(zhuǎn)的處理方式

    Shiro中session超時(shí)頁面跳轉(zhuǎn)的處理方式

    這篇文章主要介紹了Shiro中session超時(shí)頁面跳轉(zhuǎn)的處理方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-06-06
  • 使用ServletInputStream()輸入流讀取圖片方式

    使用ServletInputStream()輸入流讀取圖片方式

    這篇文章主要介紹了使用ServletInputStream()輸入流讀取圖片方式,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-10-10
  • 關(guān)于springboot 配置date字段返回時(shí)間戳的問題

    關(guān)于springboot 配置date字段返回時(shí)間戳的問題

    這篇文章主要介紹了springboot 配置date字段返回時(shí)間戳的問題,在springboot2.0后,spring會將Date字段自動給轉(zhuǎn)成UTC字符串了(在沒有配置的情況下),所以date需要轉(zhuǎn)換成時(shí)間戳還是yyyy-MM-dd HH:mm:ss,具體解決方法跟隨小編一起看看吧
    2021-07-07
  • 詳解Guava Cache本地緩存在Spring Boot應(yīng)用中的實(shí)踐

    詳解Guava Cache本地緩存在Spring Boot應(yīng)用中的實(shí)踐

    Guava Cache是一個(gè)全內(nèi)存的本地緩存實(shí)現(xiàn),本文將講述如何將 Guava Cache緩存應(yīng)用到 Spring Boot應(yīng)用中。具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-01-01
  • 解決redisTemplate向redis中插入String類型數(shù)據(jù)時(shí)出現(xiàn)亂碼問題

    解決redisTemplate向redis中插入String類型數(shù)據(jù)時(shí)出現(xiàn)亂碼問題

    這篇文章主要介紹了解決redisTemplate向redis中插入String類型數(shù)據(jù)時(shí)出現(xiàn)亂碼問題,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • 詳解spring boot整合JMS(ActiveMQ實(shí)現(xiàn))

    詳解spring boot整合JMS(ActiveMQ實(shí)現(xiàn))

    本篇文章主要介紹了詳解spring boot整合JMS(ActiveMQ實(shí)現(xiàn)),小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-10-10
  • SpringMvc實(shí)現(xiàn)簡易計(jì)算器功能

    SpringMvc實(shí)現(xiàn)簡易計(jì)算器功能

    這篇文章主要為大家詳細(xì)介紹了SpringMvc實(shí)現(xiàn)簡易計(jì)算器功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-07-07

最新評論