applicationcontext

Monodroid getApplicationContext()?

一世执手 提交于 2020-01-14 10:28:33
问题 Does anybody know how to get the application context in monodroid (I'm searching for the monodroid implementation of getApplicationContext())? I tried Application.ApplicationContext but it doesn't work. I wrote a class inheriting Application and I want to explicitly cast the ApplicationContext to this type. At this point mono dies with a really unhelpful message on the output: 10-12 11:58:31.045 I/mono ( 1919): Stacktrace: 10-12 11:58:31.045 I/mono ( 1919): Edit: I want to access it from an

Spring FileSystemXmlApplicationContext don't find the bean configuration file and go into error

折月煮酒 提交于 2020-01-11 07:16:28
问题 I am trying to do the following Spring "Hello World" example that use the FileSystemXmlApplicationContext as implementation of ApplicationContext interface. This implementation have to take the full path of the XML bean configuration as constructor parameter, something like the previous example: ApplicationContext context = new FileSystemXmlApplicationContext("C:/Users/ZARA/workspace/HelloSpring/src/Beans.xml"); I use Linux and my Beans configuration file is under the following path: /home

How correctly close the ApplicationContext in Spring?

孤者浪人 提交于 2020-01-09 09:52:20
问题 I am studying for the Spring Core certification and I have some dount about on this question finded into the provided study material: What is the preferred way to close an application context? I know that if I have something like this: ConfigurableApplicationContext context = … // Destroy the application context.close(); by the use of the close() method on the context objet the ApplicationContext is closed and the application is destroyed. But I think that this is not the best way that I have

How correctly close the ApplicationContext in Spring?

巧了我就是萌 提交于 2020-01-09 09:52:09
问题 I am studying for the Spring Core certification and I have some dount about on this question finded into the provided study material: What is the preferred way to close an application context? I know that if I have something like this: ConfigurableApplicationContext context = … // Destroy the application context.close(); by the use of the close() method on the context objet the ApplicationContext is closed and the application is destroyed. But I think that this is not the best way that I have

How do you reset Spring JUnit application context after a test class dirties it?

大憨熊 提交于 2020-01-09 06:34:07
问题 I'm using Spring 3.1.1.RELEASE, JUnit 4.8.1 and the HSQL 2.7.7 in-memory database. I have one test class annotated as @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({ "classpath:test-trainingSessionServiceContext.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class TrainingSessionServiceTest { The problem is, when I run "mvn clean test", it seems that all test classes run after the above class fail because the in-memory database is destroyed and

jboss spring applicationContext load on start in web.xml

自作多情 提交于 2020-01-06 19:50:22
问题 I am using wildfly 8.2.0. I want to load spring-config.xml on start However, it`s unsuccessful. What am i doing wrong? This is my web.xml. <?xml version="1.0" encoding="UTF-8"?> http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <display-name>BQP</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>src/main/resources/spring-config*.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context

when I am running test cases that time entity manager is injected successfully but while running web app its throwing NullPointerException

纵然是瞬间 提交于 2020-01-04 06:29:02
问题 I have a strange problem. I am injecting the entity manager using PersistenceContext using applicatioContext bean. But problem is that when I am running test cases that time entity manager is injected successfully but while running web app its throwing NullPointerException this is abstractRepository where I am injecting entityManager package com.ajit.retail.repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence

Picking up Tomcat's Context.xml parameters via SpEL

99封情书 提交于 2020-01-04 06:28:12
问题 Deploying war to Apache Tomcat 8 the following way. Placing myApp.xml under $CATALINA_HOME/conf/[enginename]/[hostname]/ with the following contents: <Context> <Parameter name="myApp_configs" value="file:/the/path/to/configs/folder" type="java.lang.String" override="false"/> </Context> B.t.w. I do not place any kind of Context.xml into war . Then copying myApp.war to $CATALINA_HOME/webapps This is my web.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems,

when I am running test cases that time entity manager is injected successfully but while running web app its throwing NullPointerException

只谈情不闲聊 提交于 2020-01-04 06:28:07
问题 I have a strange problem. I am injecting the entity manager using PersistenceContext using applicatioContext bean. But problem is that when I am running test cases that time entity manager is injected successfully but while running web app its throwing NullPointerException this is abstractRepository where I am injecting entityManager package com.ajit.retail.repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence

applicationContext.xml is not getting loaded when I have kept the spring-servlet.xml in Web application

六月ゝ 毕业季﹏ 提交于 2020-01-02 08:22:12
问题 I am Working on a web application in eclipse. A spring MVC web applicatication to be precised. I have created servlet xml and mapped it in web.xml. Everything is working fine till here & Servlet loads the HTML page But now I want to add a JPA layer. So I have created applicationContext.xml in WEB-INF and put all JPA related spring configurations in that file. But when I start my web application, JPA related stuff is not getting loaded. What I believe is, applicationContext.xml itself is not