我有一个旧版应用程序,使用JAX-RS for REST。现在我想集成Spring MVC,但是我无法重写所有旧代码。那么,是否可以在Spring MVC中同时使用JAX-RS?我的意思是,旧代码目前将保持不变,而新控制器将使用Spring MVC。 我正在使用Jetty作为Web服务器。
web.xml:
<servlet>
<servlet-name>Restlet</servlet-name>
<servlet-class>com.anue.webapi.RestletServlet</servlet-class>
<init-param>
<param-name>org.restlet.application</param-name>
<param-value>com.anue.webapi.RestletWebApiApplication</param-value>
</init-param>
</servlet>
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.GzipFilter</filter-class>
<init-param>
<param-name>methods</param-name>
<param-value>GET,POST</param-value>
</init-param>
<init-param>
<param-name>mimeTypes</param-name>
<param-value>text/html,text/plain,text/xml,application/xhtml+xml,text/css,application/javascript,application/json,image/svg+xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>CacheSettingsFilter</filter-name>
<filter-class>com.netoptics.server.CacheSettingsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CacheSettingsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet-mapping>
<servlet-name>Restlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>