spring 的api配置 备注

1)controller
<!-- basedata start -->
	<servlet>
		<servlet-name>basedata</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
	    <servlet-name>basedata</servlet-name>
	    <url-pattern>/application/basedata/*</url-pattern> //这里是url路径
	</servlet-mapping>
	<!-- basedata end -->

然后在basedata-servlet.xml里面配置
<context:component-scan base-package="com.cvt.smarthome" use-default-filters="false">
		<context:include-filter type="regex" expression="com.cvt.smarthome.application.basedata.controller.*"/>
	</context:component-scan>




2)api
<servlet>
		<servlet-name>api</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
	    <servlet-name>api</servlet-name>
	    <url-pattern>/api/*</url-pattern>
	</servlet-mapping>

然后在api-servlet.xml里面配置
<context:component-scan>
<context:include-filter type="regex" expression="com.cvt.smarthome.application.basedata.api.*"/>
	</context:component-scan>

你可能感兴趣的:(spring)