Questions tagged [spring-context]
95 questions
42
votes
1 answer
What is the difference between spring-context and spring-core dependencies?
Hello I am new to the Spring and maven world, and I want to know what is the difference between this 2 dependencies?
Its a simple question.. I am having trouble with my pom.xml file, so I want to know everything :).
Thanks in advance.

Juano7894
- 703
- 1
- 8
- 21
5
votes
0 answers
Springboot @MockBean not being injected when running other tests with whole context
I'm facing some problems when trying to inject a bean with the annotation @MockBean inside a Junit test.
As a result I get the real service injected instead of the mocked one, but the weird behavior is that this only happens when running tests with…

Massimo Basile
- 381
- 4
- 6
5
votes
0 answers
Spring event routing in case of generic type
I want to build event processing based on event generic type.
Event class:
public class PushNotificationStoreEvent extends ApplicationEvent {
private static final long serialVersionUID = -3791059956099310853L;
public T…

Woland
- 623
- 2
- 13
- 31
4
votes
3 answers
exclude the configuration file (.xml and package) from dependency jar in gradle spring project
In my spring project we are using web dependency contains a configuration applicationContext.xml and security-config.xml. I have to change on both of them in my application how can I achieve this.
I'm expecting like this
compile…

Araf
- 510
- 8
- 32
4
votes
1 answer
Spring @Scheduled method SecurityContext
Is @Scheduled annotated method out of any SecurityContext? When I try to use the following it always has securitycontext/auth as null. If this is not possible then what could be the right way to run user specific authentication aware scheduled…

muasif80
- 5,586
- 4
- 32
- 45
4
votes
3 answers
@Import registers non-@Component beans
I have noticed that even classes not annotated with @Component are registered into the Spring context when they are declared in the @Import annotation.
@Configuration
@Import({MyBean.class})
class MyConfig {
@Bean
Object object(MyBean…

ttulka
- 10,309
- 7
- 41
- 52
3
votes
1 answer
Autowired property is null in EnvironmentPostProcessor implementation class on startup
In my SpringBoot app, I have Autowired an configObject in the class that implements EnvironmentPostProcessor.
The injected class reads data from a different source on startup as this is required for the app to work.
But upon starting the…

continuousLearner
- 358
- 4
- 20
3
votes
0 answers
Cannot convert value of type JndiRmiProxyFactoryBean no matching editors or conversion strategy found
In my project, I have configured spring beans as follows. (To get the DataSource via JNDI). And the below configurations worked fine when I used spring 3.2.5 along with hibernate 4.

Chiran K.
- 406
- 3
- 16
2
votes
0 answers
What is the Alternative to RmiRegistryFactoryBean for ConnectorServerFactoryBean as RmiRegistryFactoryBean is deprecated?
I am having an exsiting code where we are using org.springframework.remoting.rmi.RmiRegistryFactoryBean.
I am upgrading our Spring version and looks like RmiRegistryFactoryBean is deprecated in latest spring(spring-context.jar) version.
below is the…

Sagar Chaudhari
- 73
- 1
- 6
2
votes
2 answers
Use JUnit 5 parallel test execution and still profit from Spring's context caching?
I am using Spring and JUnit 5.
In Spring tests, created contexts are cached so that they don't need to be re-created for each test.
However, according to the Spring documentation, this caching does not work when tests are executed in parallel:
Test…

Harold L. Brown
- 8,423
- 11
- 57
- 109
2
votes
1 answer
Can I force a locale with Spring's @DateTimeFormat?
I'm using Spring's @DateTimeFormat annotation, with a custom pattern, on the field of an object which is passed in via an HTTP POST endpoint. The particular field is set on the front end UI with a javascript widget which always uses the 'en_us'…

binarylegit
- 319
- 1
- 4
- 15
2
votes
1 answer
Binding two Property classes and I need to merge them to one and Bind that too
I am working in a library which configures Property classes through Spring properties in an application.yml file.
I am moving from a deprecated prefix(com.myapp.deprecated) to a new prefix(com.myapp.newprefix). I want to maintain old applications…

swhite
- 471
- 1
- 6
- 11
2
votes
2 answers
Spring Initialisation Order with Configuration
I have a Spring project, and I need to configure Flyway.
Using the default FlywayAutoConfiguration, Flyway migration is immediatly executed before everything else (caching, PostConstruct annotations, services). This is the behavior I expected (in…

Thibaut
- 2,596
- 2
- 24
- 24
2
votes
1 answer
Spring Cucumber ActiveProfiles annotation not working with CucumberContext
I'm working on a project where we have a component which consists:
core
connector to external system 1
connector to external system 2
The connectors are mutually exlusive (if connector1 is active, connector2 is always inactive and vice versa). The…

Teun van der Wijst
- 939
- 1
- 7
- 21
2
votes
1 answer
No EntityManager with actual transaction available for current thread : Multiple config xml files
Hello I face the following problem:
I Have a spring mvc app with the following configuration files. there are two separate spring config files one for jpa and one for spring mvc The problem is when I try to persist something in Database I get the…

Kasiaras Dimitrios
- 191
- 7