applicationcontext

Can't load spring 3 schemas

心已入冬 提交于 2019-12-31 03:03:20
问题 i am using Spring 3.0.5.RELEASE and today when building the project with maven, i am getting following errors in appicationContext.xml file: - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'. - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation- config'. - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for

java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present

人走茶凉 提交于 2019-12-31 01:24:29
问题 When running my webapp, I get the stacktrace listed below every other try. Note that there doesn't seem to be multiple ContextLoader definitions im web.xml as far as I can tell. Moreover, the app runs just fine the second/fourth/etc. time. This behaviour is much harder to debug than if it simply didn't work. Can anyone shed some light on this? java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have

java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present

∥☆過路亽.° 提交于 2019-12-31 01:24:11
问题 When running my webapp, I get the stacktrace listed below every other try. Note that there doesn't seem to be multiple ContextLoader definitions im web.xml as far as I can tell. Moreover, the app runs just fine the second/fourth/etc. time. This behaviour is much harder to debug than if it simply didn't work. Can anyone shed some light on this? java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have

ApplicationContext and ServletContext

做~自己de王妃 提交于 2019-12-29 11:35:31
问题 I get confused between the two ApplicationContext and ServletContext when it comes to Spring MVC Application. I know that There is just only One ApplicationContext per Spring Web Application and there is also just only One ServletContext per web application. To initiate the value for both ApplicationContext and ServletContext, in web.xml, we will add something in context-param tag. That is the point that makes me confused. What are the differences between these two (i know ApplicationContext

How to inject ApplicationContext itself

杀马特。学长 韩版系。学妹 提交于 2019-12-28 02:40:50
问题 I want to inject an ApplicationContext itself to a bean. Something like public void setApplicationContext(ApplicationContect context) { this.context = context; } Is that possible in spring? 回答1: Previous comments are ok, but I usually prefer: @Autowired private ApplicationContext applicationContext; 回答2: Easy, using the ApplicationContextAware interface. public class A implements ApplicationContextAware { private ApplicationContext context; public void setApplicationContext(ApplicationContext

ClassPathXmlApplicationContext from a Runtime.getRuntime.exec

时光总嘲笑我的痴心妄想 提交于 2019-12-25 09:01:04
问题 I developp a web app in eclipse with spring to handle dependency injection & maven to deploy. I'm trying to make work this little code : public class MainExternal { public static void main( String[] args ) throws Exception{ @SuppressWarnings("resource") ApplicationContext appContext = new ClassPathXmlApplicationContext( "classpath*:webConfiguration/applicationContext.xml"); ProjectBo projectBo = (ProjectBo) appContext.getBean("projectBo"); System.out.println("-> Im 'in "); /*************

Which issue does JNDI solve that ApplicationContext does not solve in Spring?

会有一股神秘感。 提交于 2019-12-24 13:43:18
问题 JNDI is a mean to retrieve/store data or objects from string names. This feature is provided by the container running the application. ApplicationContext allows the creation and retrieval of beans from their string name. Both serve similar needs. Yet, Spring offers means to retrieve objects from JNDI. One can also access JNDI via the JndiTemplate . Is there a real need to use JNDI in Spring? Which problem does it solve that ApplicationContext does not? 回答1: The Application Context would not

Wiring multiple independent Spring Applications using Maven

大憨熊 提交于 2019-12-24 01:53:53
问题 My project consists of multiple Spring subprojects: Service1 Service2 Service3 Every Service has multiple dependencies to other Beans inside, so every Service has an applicationContext.xml wiring the Service together. I made every subproject an standalone maven build and i thought i can create a AllServicesTogether Application to wire those Service{1..3} together. This works by adding maven dependencies to those Services. <dependencies> <dependency> <groupId>org.myproject</groupId>

Failed to load Spring ApplicationContext

我的梦境 提交于 2019-12-23 18:04:27
问题 I'm writing unit tests for a spring application which is sort of complex. I want to load spring context in order to use defined beans. My context.xml is located at: src/main/resources/context.xml After maven build, the context.xml appears at: target/classes/context.xml In the pom.xml, I have: (As suggested by this post) <resources> <resource> <filtering>true</filtering> <directory>src/test/resources</directory> <includes> <include>**/*.properties</include> </includes> <excludes> <exclude>**/

META-INF/persistence.xml cannot be opened because it does not exist

三世轮回 提交于 2019-12-22 17:23:26
问题 I'm creating a basic spring-maven project that should run as a java application (in process, not over a web server). My application context resides under the resources folder which is in my classpath: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www