FAQ Database Discussion Community


Object Sharing Between Activities in Android

android,singleton,sharing,applicationcontext
Hi I have a question about passing an object throughout the app. Say I want to have a big custom object throughout the app. This object will be used by multiple activities and services. What I did at first is this. First, I created an Application class and define a...

Static Singleton Instance of Spring's ApplicationContext

java,spring,applicationcontext
I'm trying to port an application written with CURAM to a Struts2 project. We are using Spring to take advantage of its database transaction capabilities. Do to the way application code is written in a CURAM application, I cannot use the Dependency Injection feature of Spring. I need to be...

C# Can Not Access public member of Form from Parent Class

c#,winforms,applicationcontext
I am trying to add an event handler in a Class that refers to an event of a Form Control which is instantiated within that Class. All classes exist within the same namespace. The program is based on an ApplicationContext forms application. Within static void Main() in Program.cs CustomApplicationContext applicationContext...

Why I must have a default constructor in a Spring configuration class annoted by the @Constructor annotation?

java,spring,spring-mvc,annotations,applicationcontext
I am studying for Spring Core certification and, on the provided study stuff, I have this question but I can't give an answer to it. Why must you have to have a default constructor in your @Configuration annotated class? I don't declare any constructor into my configuration classes annoted by...

Spring Context not loaded

java,spring,applicationcontext,servletcontextlistener
I am trying to migration an old project of mine from Spring 3.0.3.RELEASE to 4.0.9.RELEASE. I changed the pom.xml dependency to the 4.0.9, from that moment i am facing the problem. DispatcherServlet is not able to find the beans in the application context. Following are my files web.xml <context-param> <param-name>bootstrapConfig</param-name>...

Loading context after application context

java,spring,applicationcontext
I have a doubt which is similar to the one here: Class Loading Application Context Spring But I also want to load the dependencies of the classes loaded after the application context. Is that possible to achieve?...

Use ApplicationContext if possible in Android?

android,applicationcontext,android-context
Is it a good practice to use application context instead of other context(Activity, Service and so on) if possible? Pros: Application context can help us avoid memory leak. Application context can help eliminate params in some circumstances Other things don't come to my head for now Cons: No clue for...

Why in Spring JUnit test a new ApplicationContext is initialized and created for each test method? [closed]

java,spring,junit,applicationcontext,spring-test
I am studying unit test in Spring and I have the following doubt. Why a new ApplicationContext is initialized and created for each test method? Why Spring need a new ApplicationContext for each test method and not reuse a same ApplicationContext created before perfome any method?...

Can't load Spring Context correctly

java,spring,service,javabeans,applicationcontext
What I'm doing: I'm loading my Spring application external JAR into another non-spring application. I'm doing it like this: ApplicationContext ap = new ClassPathXmlApplicationContext("classpath:/META-INF/spring/application-context.xml"); MyService myService = (MyService) ap.getBean("myBusinessService"); this is the exception that I receive: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myBusinessService': Injection of autowired dependencies failed; nested exception...

Get list of installed applications within library Android

android,android-library,applicationcontext
I've found this answer How to get a list of installed android applications and pick one to run But it doesn't answer my problem completely, although I only have to find if a specific application is installed, I have no context in the library, so i can call getPackageManager() and...

How to activate JSR-250 annotation into a Spring application that is not configured using the XML configuration file?

java,spring,spring-mvc,applicationcontext
I know that if I want use the JSR-250 annotations inside a Spring application configured by XML configuration file I have to put this tag inside the XML configuration file: <context:annotation-config/> But what I need to do to activate the JSR-250 annotations if I am using a Java configuration class...

Loading Properties file is giving weird behavior

java,spring,properties,applicationcontext
Consider this example public class EmailSender { private Properties emailProperties; public Properties getEmailProperties() { return emailProperties; } public void setEmailProperties(Properties emailProperties) { this.emailProperties = emailProperties; } In applicationContext.xml I have something like <bean name="emailSender" class="com.api.email.EmailSender"> <property name="emailProperties" value="classpath*:email.properties"/> </bean> When I debug whats get set, I see How do I...