我正在尝试将 BlazeDS 添加到 Spring Boot 应用程序中。为此,我在配置中添加了“MessageBrokerServlet”:
@Bean
public ServletRegistrationBean messageBrokerRegistration()
{
ServletRegistrationBean registration = new ServletRegistrationBean(new MessageBrokerServlet(), "/messagebroker/*");
Map<String,String> params = Maps.newHashMap();
params.put( "services.configuration.file", "/WEB-INF/flex/services-config.xml" );
registration.setInitParameters(params);
return registration;
}
servlet 被加载,但在运行时失败:
MessageBrokerServlet in application 'undefined' failed to initialize due to runtime exception:
Exception: flex.messaging.config.ConfigurationException: Please specify a
valid 'services.configuration.file' in web.xml. You specified '{0}'.
This is not a valid file system path reachable via the app server and
is also not a path to a resource in your J2EE application archive.
翻阅 BlazeDS 的源代码,我看到最后,代码使用了ServletContext#getResourceAsStream(path)
. 如何使 Spring Boot 中的嵌入式 tomcat 在该调用中返回某些内容?
我正在使用使用嵌入式 Tomcat 7.0.54 的 Spring Boot 1.1.1