Questions tagged [spring-context]

95 questions
0
votes
1 answer

override command line Spring properties with bootstrap.yml

i have a tomcat box , which has spring active profile set already, as a command line argument every time a spring app is deployed through catalina. i am using spring cloud config server , so in config client i specify active profile in…
0
votes
1 answer

creating bean of a class in Spring Boot application?

I am trying to excess Entity Manager directly from Spring boot application. But I am unable to create bean of a class containing methods which I need. I am referring from the following…
deep
  • 143
  • 3
  • 12
0
votes
1 answer

How to externalize applicationContext and construct the ClassPathXmlApplicationContext object

I need to externalize by spring applicationContext configuration. I run my jar as : java -jar myjar.jar --spring.config.location=file:///Users/nsarkar/temp/config/applicationContext.xml How would spring understand this property and what do i have…
Nilotpal
  • 3,237
  • 4
  • 34
  • 56
0
votes
1 answer

Does spring resolve property placeholders for lazy beans during context creation?

I have a bean definition like spring xml context file Does spring try to resolve the property…
Vishal
  • 666
  • 1
  • 8
  • 30
0
votes
0 answers

Spring ignoring the classloader

Java 9 and 11 often make it necessary to use a custom classloader. So I created a BootstrapClassloader that preloads my classpaths, and I use Thread.currentThread().setContextClassLoader(classloader) to make it the default. I soon caught Spring…
0
votes
1 answer

@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)

I'm upgrading spring form 4.3.3 to 5.2.7 and I'm having this exception: Exception: Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean' defined in com.test: Unsatisfied dependency…
aabc
  • 9
  • 5
0
votes
0 answers

What is the difference if I put annotation @Component on the interface or implementation class?

For example, I have interface IRobot and I have an implementation RobotImpl. If I put annotation @Component on the interface will spring scan all it`s implementations? I think that annotation @Component is like saying "Hey Spring, create me an…
cplusplus
  • 92
  • 8
0
votes
1 answer

Where is spring context stored and what is the data structure?

Where is spring context stored? In which data structure? ( I heard it's just a Map, is it?) ( I don't mean the path to the xml file, I mean when Spring read bean definitions it stored the information about it somewhere and injects it)
J.J. Beam
  • 2,612
  • 2
  • 26
  • 55
0
votes
1 answer

Spring Context Hierarchy: How to initialize child contexts concurrently

I use the Spring Boot Fluent Builder API to build a Spring context Hierarchy like described here. Is it possible to initialize the child contexts concurrently?
Oliver
  • 353
  • 1
  • 4
  • 16
0
votes
1 answer

Spring Boot prototype bean: injection from Spring Context and supplied parameters

I have a Spring Boot application, in which I use "prototype" beans. I know it is possible to inject parameters through constructors arguments but I would like to avoid the approach, as I have a number of additional configuration parameters,…
Peter G. Horvath
  • 535
  • 1
  • 3
  • 15
0
votes
1 answer

Integration test with Spring-context doesn't receive RabbitMQ messages

RabbitMQ MessageConsumer doesn't receive the published message I'm writing an integration test which should received a message from a queue and do the processing. But the consumer simply doesn't receive the message. When I manually inject the…
Guerino Rodella
  • 321
  • 4
  • 16
0
votes
0 answers

Relation between Spring Container and implementation of BeanFactory?

I'm beginner with Spring and I have issues understanding how those two work. I will work my question through example. We have project with Spring Core module, in that project we have two classes annotated with @Component in different packages and…
0
votes
1 answer

Autowired on Constructor with parameters fails

I have following sample code: Bean class: package com.example.learn1.bean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class Bean1 { private String name; …
CuriousMind
  • 8,301
  • 22
  • 65
  • 134
0
votes
1 answer

Instantiate Bean on Demand With Runtime-Defined Configuration

In my application I would like to instantiate a class on demand and pass some runtime parameters to is as well as have Spring automatically fulfil any @Autowired dependencies. For example, the class I would like to instantiate on…
D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97
0
votes
1 answer

Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/p]

I'm beginner in SPRING , I have got this error Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace my spring-app-context.xml
AlexAnt
  • 53
  • 1
  • 4