草庐IT

BHSM-Servlet

全部标签

java - servlet容器和spring容器有什么区别?

关闭。这个问题需要更多focused.它目前不接受答案。想要改进这个问题吗?更新问题,使其只关注一个问题editingthispost.关闭7年前。Improvethisquestionservlet容器和spring容器的作用和职责是什么?请有人澄清我的疑问。 最佳答案 如果它们的名称相似,它们也是非常不同的概念。ServletContainer或WebContainer(如Tomcat)是JavaServlet、JSP等各种JavaEE规范的实现。简单地说,它是一个Java环境web应用程序可以生存。Web服务器+Java支持。

unit-testing - 单元测试 Spring MVC web-app : Could not autowire field: private javax. servlet.ServletContext

我想为我的web应用程序进行测试,但上下文配置在AutowiringservletContext时崩溃。下面的错误。当我在tomcat/jetty上运行web-app时,AutowiringservletContext效果很好。java.lang.IllegalStateException:FailedtoloadApplicationContext...Causedby:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'testController':Injectiono

unit-testing - 单元测试 Spring MVC web-app : Could not autowire field: private javax. servlet.ServletContext

我想为我的web应用程序进行测试,但上下文配置在AutowiringservletContext时崩溃。下面的错误。当我在tomcat/jetty上运行web-app时,AutowiringservletContext效果很好。java.lang.IllegalStateException:FailedtoloadApplicationContext...Causedby:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'testController':Injectiono

java - Tomcat 7 上的 Servlet 3 异步任务

我正在尝试使用Servlet3.0和基于其异步支持的Comet模式来实现简单聊天。这篇文章启发了我:http://www.javaworld.com/javaworld/jw-02-2009/jw-02-servlet3.html?page=3我的servlet看起来像这样。@WebServlet(name="chatServlet",urlPatterns={"/ChatServlet"},asyncSupported=true)publicclassChatServletextendsHttpServlet{protectedvoiddoGet(HttpServletRequest

java - 使用 Servlet 2.5 测试 Spring Framework 4

我在让SpringFramework4与使用Servlet2.5的现有项目一起工作时遇到问题。我的web项目实际上运行良好,但我的测试用例失败了,这是由MockHttpServletRequest引起的,它抛出了这个异常:-java.lang.NoClassDefFoundError:javax/servlet/AsyncContextatjava.net.URLClassLoader$1.run(URLClassLoader.java:202)atjava.security.AccessController.doPrivileged(NativeMethod)我尝试添加任何一个依赖项

java - 使用 Servlet 2.5 测试 Spring Framework 4

我在让SpringFramework4与使用Servlet2.5的现有项目一起工作时遇到问题。我的web项目实际上运行良好,但我的测试用例失败了,这是由MockHttpServletRequest引起的,它抛出了这个异常:-java.lang.NoClassDefFoundError:javax/servlet/AsyncContextatjava.net.URLClassLoader$1.run(URLClassLoader.java:202)atjava.security.AccessController.doPrivileged(NativeMethod)我尝试添加任何一个依赖项

java - 依赖注入(inject) servlet 监听器

在我的Stripes应用中,我定义了以下类:MyServletListenerimplementsServletContextListener,HttpSessionListener,HttpSessionAttributeListener{privateSomeServicesomeService;privateAnotherServiceanotherService;//remainingimplementationomitted}这个应用程序的服务层使用Spring在XML文件中定义和连接一些服务bean。我想将实现SomeService和AnotherService的bean注

java - 依赖注入(inject) servlet 监听器

在我的Stripes应用中,我定义了以下类:MyServletListenerimplementsServletContextListener,HttpSessionListener,HttpSessionAttributeListener{privateSomeServicesomeService;privateAnotherServiceanotherService;//remainingimplementationomitted}这个应用程序的服务层使用Spring在XML文件中定义和连接一些服务bean。我想将实现SomeService和AnotherService的bean注

spring - 使用 spring boot 配置多个 servletcontainers/servlet

我想使用SpringBoot在不同端口上加载两个具有嵌入式tomcat配置的servlet容器。有谁知道如何做到这一点? 最佳答案 应该很简单:只需根据需要创建任意数量的ApplicationContexts,类型为EmbeddedWebApplicationContext,并为它们各自分配一个具有不同端口的EmbeddedServletContainerFactory.示例here其中两个上下文是父级和子级,但这不是设置的必要部分。 关于spring-使用springboot配置多个s

spring - 使用 spring boot 配置多个 servletcontainers/servlet

我想使用SpringBoot在不同端口上加载两个具有嵌入式tomcat配置的servlet容器。有谁知道如何做到这一点? 最佳答案 应该很简单:只需根据需要创建任意数量的ApplicationContexts,类型为EmbeddedWebApplicationContext,并为它们各自分配一个具有不同端口的EmbeddedServletContainerFactory.示例here其中两个上下文是父级和子级,但这不是设置的必要部分。 关于spring-使用springboot配置多个s