Questions tagged [applicationcontext]

The Spring `ApplicationContext` class

The Spring ApplicationContext class is the central interface to provide configuration to any Spring application.

869 questions
0
votes
1 answer

Passing a parameter to a bean referenced in a constructor in Spring

I want to pass a parameter to a bean referenced from another bean in Spring Context.xml. Is it even possible ? NOTE : The DISCARD bean would have different values when referenced from different beans.
Amber
  • 1,229
  • 9
  • 29
0
votes
2 answers

Spring contex load twice

When server start, application context loaded twice as you can see in log. When I am using Spring Scheduled annottation it runs twice because of my application context load twice. When I deleted contextLoadListener scheduler works nice (only one…
0
votes
0 answers

spring aspects working without explicit definition in application context

In my project, I have an aspect defined as follows: @Aspect public class UselessAspect { @Around("execution(* com.x.y.UselessClass.*.*(..))") public Object logAroundUselessClassMethods(ProceedingJoinPoint joinPoint) throws Throwable { //…
hrishikeshp19
  • 8,838
  • 26
  • 78
  • 141
0
votes
3 answers

Spring context loader

I have a question about spring context. My application's using spring and spring scheduler. In web.xml, i declared: org.springframework.web.context.ContextLoaderListener My question is: If…
namtn
  • 71
  • 1
  • 6
0
votes
1 answer

Spring load properties into context from FTP Server

I have an application (not webapplication) with its property file. And I need to load into its context several properties from a file on a server, but I couldn't (because I don't know how or I have misunderstood something about that). I have a class…
Elorry
  • 33
  • 7
0
votes
2 answers

Android access raw file inside class without Context (non- Activity)

I have a code inside myActivity.class InputStream inputStream = getApplicationContext().getResources().openRawResource(R.raw.text); BufferedReader buff = new BufferedReader(new InputStreamReader(inputStream)); String s; ArrayList list = new…
Victor G
  • 5
  • 2
  • 4
0
votes
0 answers

Spring + JPA + Maven + JSF problems with datasource configuration

I get the following error whenever I try to run/deploy a maven project, which I feel is properly developed. The error .. Build Path is incomplete. Cannot find class file for org/apache/commons/pool/impl/Generic/ObjectPool....is found on the line …
QNNet
  • 73
  • 10
0
votes
1 answer

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

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: But what I need to do to activate the JSR-250…
Java Surfer
  • 613
  • 3
  • 9
  • 13
0
votes
1 answer

Is Spring Profile application context specific?

I've created a web project with parent child application context configured. The root application context configured with infrastructure beans(Datasource, Transaction, ORM, Cache, security), and web application context configured with view…
John Han
  • 23
  • 1
  • 5
0
votes
1 answer

Conditionally load application context

How can I load a spring-beans xml file from one out of two locations? System.getProperty("conf.dir") + "/context.xml" if it exist, otherwise fall back to classpath:/context.xml This is what I started out with but I only want to load the first…
Johan Sjöberg
  • 47,929
  • 21
  • 130
  • 148
0
votes
1 answer

No qualifying bean ... spring-webmvc: bean defined in applicationContext is not visible in ServletContext

I have problems with beans defined in APplicationContext. (May be my problems is understanding of Application~Servlet contexts ?) So, I define < bean id="messageSource" in : applicationContext.xml …
0
votes
1 answer

How to prevent main context from fail if the import context failed?

I have a spring application and I need to import some contexts via bean initialization, like this: And if there are any errors while importing, program…
TEXHIK
  • 1,369
  • 1
  • 11
  • 34
0
votes
1 answer

Loading beans from jar with dependency

I have a scenario where in I need to simulate the following- Say I have a project 'LoadingBean'. I need to load classA (from project 'External' as a JAR added to classpath of 'Loading Bean') after the application context has been loaded for…
Natasha
  • 367
  • 1
  • 5
  • 15
0
votes
1 answer

Can't load Spring Context correctly

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…
abierto
  • 1,447
  • 7
  • 29
  • 57
0
votes
1 answer

Spring @ContextHierarchy in a multilevel test class hierarchy (using Scala and ScalaTest)

Instead of having several full blown applications contexts, copy&pasting 99% of the content and adding/removing only a few lines where the context should differ, I'd rather have all the generic stuff in one parent context i.e. "rootContext.xml".…
simou
  • 2,467
  • 4
  • 30
  • 39