我正在使用嵌入式码头:
ServletContextHandler context = new ServletContextHandler();
JettyHttpThreadPool jettyHttpThreadPool = new JettyHttpThreadPool(serviceName);
server.setHandler(context);
server.start();
我的弹簧上下文 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
我得到 404 http 状态码。
我做错了什么?为什么我无法获取静态资源?