Questions tagged [applicationcontext]

The Spring `ApplicationContext` class

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

869 questions
11
votes
3 answers

java.lang.IllegalArgumentException: No PersistenceProvider specified in EntityManagerFactory configuration

i have created a maven project and added Spring4, Hibernate4 libs through pom.xml I m trying to link my web app with my database created in PostgreSql, but when i publish my project in apache tomcat 7 the following exception occurs :…
11
votes
3 answers

How correctly close the ApplicationContext in Spring?

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…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
10
votes
3 answers

configure dataSource for liquibase in spring boot

I have a spring boot application and I want to add liquibase configuration change log for it. I have created a LiquibaseConfig class for configuring liquibase: @Configuration public class LiquibaseConfiguration { …
Muhammad Bekette
  • 1,396
  • 1
  • 24
  • 60
10
votes
1 answer

Modify active profiles and refresh ApplicationContext runtime in a Spring Boot application

I have a Spring boot Web application. The application is configured via java classes using the @Configurable annotation. I have introduced two profiles: 'install', 'normal'. If the install profile is active, none of the Beans that require DB…
SaWo
  • 1,515
  • 2
  • 14
  • 32
10
votes
1 answer

Spring DI applicationContext.xml how exactly is xsi:schemaLocation used?

Note: the test project I'm mentioning can be downloaded with: git clone https://github.com/mperdikeas/so-spring-di-appcontext-schemalocation.git .. and run with 'ant run'. I 'understand' that XML namespace names are just used as opaque identifiers…
Marcus Junius Brutus
  • 26,087
  • 41
  • 189
  • 331
9
votes
1 answer

JUnit custom runner with Spring application context

I am fairly new to Spring and am working with a suite of JUnit 4.7 integration tests for a web application. I have a number of working test cases of the form: import org.junit.Test; import org.junit.runner.RunWith; import…
DrewCo
  • 954
  • 2
  • 8
  • 20
9
votes
1 answer

How does Spring create an application context or container hierarchy?

According to The IoC Container, Spring can manage a context hierarchy or hierarchy of containers and then use the to refer to a bean in a parent context. What mechanism does Spring use to create this container hierarchy? Can…
Derek Mahar
  • 27,608
  • 43
  • 124
  • 174
9
votes
0 answers

How to shutdown application context between tests

I have 3 groups of tests: unit, integration, acceptance. Latter two groups launches ApplicationContext: minimal for "integration" and full for "acceptance". Both application contexts register queue subscriber. Application contexts are deregistered…
9
votes
2 answers

How to configure Spock test to load Spring Context (for @Autowired)?

I have such Application class: @Configuration @EnableAutoConfiguration @ComponentScan @ImportResource("classpath:applicationContext.xml") @EnableJpaRepositories("ibd.jpa") public class Application { public static void main(String[] args) { …
Lesya Makhova
  • 1,340
  • 3
  • 14
  • 28
9
votes
4 answers

Loading applicationcontext.xml when using SpringApplication

Could anyone provide an example of a SpringApplication that loads an applicationContext.xml file? I'm attempting to move my GWT RPC application to a RESTful web service by using a Spring's Example (Gradle based). I have an applicationContext.xml but…
Raster
  • 157
  • 1
  • 2
  • 7
9
votes
4 answers

Is it possible to inject a bean defined with @Component as an argument to a BeanFactoryPostProcessor?

And if so which configuration is needed? Is this not recommended? The annotated class: package com.springbug.beanfactorydependencyissue; import javax.annotation.Resource; import org.springframework.stereotype.Component; @Component public class…
jontejj
  • 2,800
  • 1
  • 25
  • 27
9
votes
5 answers

How to get Spring WebContext in class annotated @controller

In Spring MVC with annotation, we mark any POJO with @Controller. In this controller we can get WebApplicationContext, using autowired property. @Controller public class HomePageController { @Autowired ApplicationContext act; …
Kaushik Lele
  • 6,439
  • 13
  • 50
  • 76
8
votes
1 answer

Multi-threaded Context initialization with spring?

I have a traditional 3-tier application with spring. One of my repositories needs > 3 minutes for initialization so I thought about some multi-threaded approach in order to speed up the whole process - I think most service and controllers in my…
Jan
  • 2,803
  • 6
  • 36
  • 57
8
votes
2 answers

Can I have the META-INF folder into src/main/resources of a Spring command line application?

I am working on a batch aplication implemented using Spring. In this application I found the following structure: BATCH PROJECT | | |------> src/main/java (containing the packages) | |------> src/main/resources …
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
8
votes
1 answer

Object Sharing Between Activities in Android

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…
user2062024
  • 3,541
  • 7
  • 33
  • 44
1 2
3
57 58