
windchill的web.xml檔案中有如下代碼:
<servlet-mapping>
<servlet-name>MVCDispatcher</servlet-name>
<url-pattern>/servlet/WizardServlet/*</url-pattern>
<url-pattern>/servlet/ActionsMenu/*</url-pattern>
<url-pattern>/servlet/RecentList/*</url-pattern>
<url-pattern>/servlet/Navigation/*</url-pattern>
<url-pattern>/servlet/SuggestServlet/*</url-pattern>
<url-pattern>/servlet/TypeBasedIncludeServlet/*</url-pattern>
<url-pattern>/servlet/UIValidationAJAXServlet/*</url-pattern>
<url-pattern>/ptc1/*</url-pattern>
<url-pattern>/app/*</url-pattern>
<url-pattern>/gwt/*</url-pattern>
</servlet-mapping>
<servlet>
<description>MVC Dispatcher Servlet</description>
<servlet-name>MVCDispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextClass</param-name>
<param-value>com.ptc.mvc.components.support.ComponentXmlWebApplicationContext</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
web.xml的上述配置内容,實際上依據spring的規則,預設制定了名為MVCDispatcher-servlet.xml這個檔案為Spring容器的web層配置檔案
也就是說MVCDispatcher-servlet.xml制定controller的位置,配置檔案的樣子如下圖:
好的,這說明我們找到了windchill中springmvc的配置檔案。
實際上web.xml檔案中當然也配置了spring本身,代碼如下:
<context-param>
<description>Location of Spring root web application context</description>
<param-name>contextConfigLocation</param-name>
<param-value>config/mvc/applicationContext.xml</param-value>
</context-param>
如下圖位置的這個配置檔案,就是spring本身的配置檔案。
我們先來看看Windchill中Spring配置檔案applicationContext.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"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- 整個spring容器最底層一個注冊的bean,估計這個bean是ptc封裝的資料庫通路類 The shared DataSourceConfig for a given servlet context -->
<bean id="dataSourceConfig" class="com.ptc.mvc.ds.server.DefaultDataSourceConfig"/>
<!-- Creates DataSourceSession instances, manages the thread pools -->
<bean id="dataSourceManager" class="com.ptc.mvc.ds.server.DefaultDataSourceManager">
<constructor-arg ref="dataSourceConfig" />
</bean>
<!-- JMX monitor -->
<bean class="com.ptc.mvc.ds.server.jmx.DataSourceMonitor">
<property name="manager" ref="dataSourceManager" />
</bean>
</beans>
上述applicationContext.xml似乎隻配置了一個資料庫通路的ptc自己封裝的類
然後我們看看springmvc的配置檔案,如下:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="classpath:config/mvc/mvc.xml" />
<import resource="classpath:config/mvc/jca-mvc.xml" />
<import resource="classpath:config/mvc/*-configs.xml" />
<import resource="classpath:config/mvc/custom.xml" />
<bean id="defaultHandlerMappings"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>classpath:/config/mvc/*-urlMappings.properties</value>
<value>classpath:/config/mvc/custom.properties</value>
</list>
</property>
</bean>
</beans>
如上所示,springmvc的配置檔案導入了另外4個配置檔案,如下圖:
windchill的springmvc配置檔案居然加載了133個另外的配置檔案。