草庐IT

guice-servlet

全部标签

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

java - CDI 的实例或 Guice 提供者的 Spring 等效项是什么

在CDI中,您可以定义一个对象,该对象将为您提供特定类型的项目,使用:@InjectInstancemyObjectInstance;//...MyObjectmyObjectInstance.get();在Guice中您也可以这样做:@InjectProvidermyObjectInstance;//...MyObjectmyObjectInstance.get();我想知道Spring中是否有类似的构造,或者您必须使用ApplicationContext才能获得引用? 最佳答案 所以经过大量挖掘后,我发现Spring支持JSR-

java - CDI 的实例或 Guice 提供者的 Spring 等效项是什么

在CDI中,您可以定义一个对象,该对象将为您提供特定类型的项目,使用:@InjectInstancemyObjectInstance;//...MyObjectmyObjectInstance.get();在Guice中您也可以这样做:@InjectProvidermyObjectInstance;//...MyObjectmyObjectInstance.get();我想知道Spring中是否有类似的构造,或者您必须使用ApplicationContext才能获得引用? 最佳答案 所以经过大量挖掘后,我发现Spring支持JSR-

java - 如何在 web.xml 中配置 spring-boot servlet?

我在web.xml中有一个简单的servlet配置:appServletorg.atmosphere.cpr.MeteorServletorg.atmosphere.servletorg.springframework.web.servlet.DispatcherServletcontextClassorg.springframework.web.context.support.AnnotationConfigWebApplicationContextcontextConfigLocationnet.org.selector.animals.config.ComponentConfig

java - 如何在 web.xml 中配置 spring-boot servlet?

我在web.xml中有一个简单的servlet配置:appServletorg.atmosphere.cpr.MeteorServletorg.atmosphere.servletorg.springframework.web.servlet.DispatcherServletcontextClassorg.springframework.web.context.support.AnnotationConfigWebApplicationContextcontextConfigLocationnet.org.selector.animals.config.ComponentConfig

spring - 多个应用程序上下文,多个调度程序 servlet?

直到现在我一直认为一个web应用程序只能有一个dispatcher-servlet我们在web.xml中定义我这样想对吗?我可以在一个Web应用程序中拥有多个调度程序servlet吗?如果是,如何?在什么情况下我们可能需要这个?整个网络应用程序中可以只有一个应用程序上下文吗?我们如何定义多个应用程序上下文?dispatcher-servlet可以存在于非Spring应用程序中吗? 最佳答案 Canyouhavemultipledispatcherservletsinasinglewebapplication?当然,引用officia

spring - 多个应用程序上下文,多个调度程序 servlet?

直到现在我一直认为一个web应用程序只能有一个dispatcher-servlet我们在web.xml中定义我这样想对吗?我可以在一个Web应用程序中拥有多个调度程序servlet吗?如果是,如何?在什么情况下我们可能需要这个?整个网络应用程序中可以只有一个应用程序上下文吗?我们如何定义多个应用程序上下文?dispatcher-servlet可以存在于非Spring应用程序中吗? 最佳答案 Canyouhavemultipledispatcherservletsinasinglewebapplication?当然,引用officia

java - 根上下文和调度程序 servlet 上下文到底是如何进入 Spring MVC Web 应用程序的?

我正在学习SpringMVC,我有一些疑问所以,我有这个配置类来配置处理用户请求的DispatcherServlet:publicclassMyWebAppInitializerimplementsWebApplicationInitializer{@OverridepublicvoidonStartup(ServletContextcontainer){//Createthe'root'SpringapplicationcontextAnnotationConfigWebApplicationContextrootContext=...//Createthedispatcherser