0
JUnit測試案例CXF JAXRS休息服務得到下述錯誤(展示了其編程配置的解決方案,但在尋找Spring XML配置解決方案) -CXF Jetty的錯誤:java.lang.IllegalStateException:沒有SessionManager
Caused by: java.lang.IllegalStateException: No SessionManager
at org.eclipse.jetty.server.Request.getSession(Request.java:1402)
Junit的annotations-爲
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(locations = {"classpath:test-spring-context.xml"})
彈簧配置JAXRS服務器 -
<jaxrs:server id="testServer" address="http://localhost:9191/$$$/service">
<jaxrs:inInterceptors>
<ref bean="cxfRestInInterceptor" />
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
<ref bean="cxfRestOutInterceptor" />
</jaxrs:outInterceptors>
<jaxrs:serviceBeans>
<bean class="$$$" />
</jaxrs:serviceBeans>
<jaxrs:features>
<ref bean="swagger2Feature" />
</jaxrs:features>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
<bean class="$$$" />
<bean class="$$$">
<property name="authenticationProvider" ref="authenticationProvider"/>
</bean>
<bean class="$$$"></bean>
<bean class="$$$"/>
</jaxrs:providers>
<jaxrs:extensionMappings>
<entry key="json" value="application/json" />
</jaxrs:extensionMappings>
</jaxrs:server>