Java 带嵌入式Jetty静态资源的Spring MVC
我使用嵌入式码头:Java 带嵌入式Jetty静态资源的Spring MVC,java,spring,spring-mvc,embedded-jetty,static-resource,Java,Spring,Spring Mvc,Embedded Jetty,Static Resource,我使用嵌入式码头: ServletContextHandler context = new ServletContextHandler(); JettyHttpThreadPool jettyHttpThreadPool = new JettyHttpThreadPool(serviceName); server.setHandler(context); server.start(); 我的spring上下文xml文件是: <mvc:annotation-driven>
ServletContextHandler context = new ServletContextHandler();
JettyHttpThreadPool jettyHttpThreadPool = new JettyHttpThreadPool(serviceName);
server.setHandler(context);
server.start();
我的spring上下文xml文件是:
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper" ref="mapper"/>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<mvc:resources mapping="css/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="images/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="lib/**" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="swagger-ui.js" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="/" location="classpath:/META-INF/resources/"/>
<bean id="mapper" class="com.rest.utils.ObjectMapperFactory"/>
<context:annotation-config/>
<context:component-scan base-package="com.rest"/>
当我试图得到http://localhost:8080/index.html 我得到404HTTP状态码
我做错了什么?为什么我不能获取静态资源?问题是另一个servlet的映射,它应该是/ans not/*您在resources文件夹下有index.html文件吗?是的,我有它。