当我部署我的独立Spring RESTful Web服务时,我得到了以下内容:
Mar 5, 2012 1:32:36 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'policy': initialization started
Mar 5, 2012 1:32:37 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'policy-servlet': startup date [Mon Mar 05 13:32:37 EST 2012]; root of context hierarchy
Mar 5, 2012 1:32:37 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/policy-servlet.xml]
Mar 5, 2012 1:32:37 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@170d9151: defining beans [restfulController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.web.servlet.view.BeanNameViewResolver#0,policyView,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Mar 5, 2012 1:32:38 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/number/] onto handler 'restfulController'
Mar 5, 2012 1:32:38 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/policyA/] onto handler 'restfulController'
Mar 5, 2012 1:32:38 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'policy': initialization completed in 1610 ms
Mar 5, 2012 1:32:38 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
但是在整合它时,我得到了这个:
Mar 5, 2012 1:36:35 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'policy'
Mar 5, 2012 1:36:36 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
此后没有错误,异常或警告。
政策servlet.xml中
<context:component-scan base-package="mastek.restController" />
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
<bean id="policyView"
class="org.springframework.web.servlet.view.xml.MarshallingView">
<constructor-arg>
<bean class="org.springframework.oxm.xstream.XStreamMarshaller">
<property name="autodetectAnnotations" value="true"/>
</bean>
</constructor-arg>
</bean>
和web.xml是
<servlet>
<servlet-name>policy</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>policy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>