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

Questions about spring reference statement and application context

I have two primary doubts about spring: When we get a bean from context, should we must use ways like : context = new ClassPathXmlApplicationContext("applicationContext.xml"); Should it be called only via this explicit way? I was thinking about…
0
votes
1 answer

Spring Interceptors configured in root ApplicationContext cannot be reached from child WebApplicationContext

Ok I understand the fact that any web application context configured through DispatcherServlet inherits all the beans already defined in the root WebApplicationContext. Nevertheless i have configured some interceptors in my root ApplicationContext …
0
votes
1 answer

Practical use of ApplicationContextAware in spring

I have had chance of working on only one project using spring , and the way it worked was Make a singleton class (lets say MySpringHelper), that has method like getBean(String beanName) What getBean(String) does is, it first checks existence of…
Lav
  • 1,283
  • 5
  • 21
  • 48
0
votes
2 answers

Spring Java-based configuration loading resources (from classpath)

Migrating from Spring XML configuration style to Spring Java-based configuration (using @Configuration) I run into an issue loading resources, in my case from the classpath. In XML I did have a bean declared like:
Marc vA
  • 51
  • 1
  • 5
0
votes
2 answers

Spring: run code before a persistence context is loaded

I have spring based multimodule application. And in my DAO module the DB (embedded derby) is started and created by the class the implements ApplicationListener. Problem that in the logs the huge stacktrace from Spring which say that there is no…
serg
  • 1,003
  • 3
  • 16
  • 26
0
votes
2 answers

Declaring persistent JPA entities in applicationContext.xml?

So, this is what I want to do. Some like so I was already able to find in openerp. I think, I could simply declare a bean, which were a JPA persistent entity as well, for example: Example.java: package my.project; @Configurable @Entity public class…
peterh
  • 11,875
  • 18
  • 85
  • 108
0
votes
1 answer

How to cumulate property placeholder?

We have a classic Maven, Spring (3.1.1) application where we created an applicationContext.xml. In this file, we have declared a property placeholder with an external file and a file in classpath. Here an example found in another question here…
MychaL
  • 969
  • 4
  • 19
  • 37
0
votes
1 answer

No message found under code 'user.status.A' for locale 'en_us'

I am attempting to maintain separate files for different types of "messages" (user messages, field labels/buttons, data values). In this attempt I am trying to get the description of different data values. For example, a UserStatus "A" might be…
0
votes
0 answers

Spring ServletContext bean (i.e. Controller) injection into ApplicationContext bean (i.e. Service, Dao)

In Spring, relationship between Application Context and Servlet Context is like parent-child. Application Context is the parent here. So, beans of Servlet Context know beans of Application Context, but vise versa is not true. But if I need to do…
biqarboy
  • 852
  • 6
  • 15
0
votes
1 answer

Spring Relative Path File Resource In Application Context

I have a quick question about getting spring to read a file from the application context that is external to the project. I have two projects; 1) Project A 2) Project Database. Project A has the following structure; ProjectA |-src |-main …
0
votes
1 answer

${project.name} lost when using PropertyPlaceholderConfigurer

I'm using Maven to build a Spring (3.0.5.RELEASE) project. In my applicationContext.xml I use PropertyPlaceholderConfigurer (to load properties from the DB) like so:
Jonas Byström
  • 25,316
  • 23
  • 100
  • 147
0
votes
1 answer

Accessing strings.xml from different contexts

Does it matter whether I access strings from strings.xml file from different contexts? I accessed it in many ways such as: getApplicationContext().getString(R.string.name),…
0
votes
1 answer

How do I get Spring app context into my test classes without cut-copy-paste?

I want to initialize Spring once and only once in my application/running code (and I do that in the main(String[] args method). Now I am writing tests, I also want to init only once in my unit test code (but it should already be init'd for my…
Jay Vee
  • 569
  • 1
  • 4
  • 6
0
votes
2 answers

Java application-context Hibernate Eclipse dtd error

i have my applicationContext-Hibernate something like this. and suddenly appears a error that says.. i open the problems perspective and i see the problem right click show details and shows. the line 81 is a…
chiperortiz
  • 4,751
  • 9
  • 45
  • 79
0
votes
1 answer

Spring Application Context Not getting Property from application.properties file

I am creating a console app with spring and gradle. I would like to include information in my application.properties file for my program to access. Above is a picture of what my class structure looks like for this tool. Here is the…
user3108671
  • 83
  • 1
  • 2
  • 10