CXF JAXRS 休息服务的 JUnit 测试用例给出以下错误(找到几个编程配置的解决方案,但正在寻找 spring xml 配置的解决方案(-
Caused by: java.lang.IllegalStateException: No SessionManager
at org.eclipse.jetty.server.Request.getSession(Request.java:1402)
朱尼特注释-
@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>
以下配置解决了 http://cxf.apache.org/docs/jetty-configuration.html-
<httpj:engine-factory bus="cxf" id="port9191">
<httpj:engine port="9191">
<httpj:threadingParameters minThreads="5"
maxThreads="15" />
<httpj:handlers>
<bean class="org.eclipse.jetty.server.handler.DefaultHandler" />
</httpj:handlers>
<httpj:sessionSupport>true</httpj:sessionSupport>
</httpj:engine>
</httpj:engine-factory>