• spring配置与Web 项目启动


    今天打算学习下spring继承quartz的用法,然后想搭建一个纯净的spring项目用来做相关的实验,虽然只是寥寥几行配置文件,但突然选择性失忆忘了这其中容器加载的过程和配置的意义。复习了下此刻写个随便记录下刚刚的领悟。

    web.xml配置

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
      <display-name>spring</display-name>
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
      </welcome-file-list>
    
      <servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>classpath:config/spring-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
      </servlet-mapping>
    
    </web-app>

    spring-servlet.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-3.0.xsd
      http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
        >
        <mvc:default-servlet-handler/>
        <context:component-scan base-package="org.spring.vincent.**.controller" />
        <mvc:annotation-driven />
        <bean
            class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/WEB-INF/jsp/"></property>
            <property name="suffix" value=".jsp"></property>
        </bean>
    
    
        <!-- ... -->
    
    </beans>

    下面是web项目启动时做的工作

    未完待续

  • 相关阅读:
    rbd-mirror新功能
    ceph查询rbd的使用容量(快速)
    Ceph Bluestore首测
    让磁盘硬盘灯常闪定位盘
    aa
    地理围栏
    Can't connect to MySQL server on localhost (10061)解决方法
    经典智力题
    MEF程序设计指南
    ESRI.ArcGIS.AnalysisTools.Erase 结果是空?
  • 原文地址:https://www.cnblogs.com/vincentren/p/5648316.html
Copyright © 2020-2023  润新知