Questions tagged [spring-ioc]

The Spring IoC is a core component of the Spring Framework. It enforces the dependency injection pattern for beans, making them loosely coupled and allowing application developers to code with abstractions.

The Spring IoC (Inversion of Control) is a core component of the Spring Framework. It enforces the dependency injection pattern for beans, making them loosely coupled and allowing application developers to code with abstractions.

It is a process whereby objects define their dependencies only through constructor arguments, factory method arguments, and properties to be set on the object after it is constructed. The container then injects those dependencies when it creates the bean.

192 questions
0
votes
4 answers

Java generic issue because of Eclipse IDE

I've installed eclipse: Eclipse Java EE IDE for Web Developers. Version: Oxygen.2 Release (4.7.2) Build id: 20171218-0600 java version is: java -version java version "1.8.0_112" Java(TM) SE Runtime Environment (build 1.8.0_112-b16) Java…
Sergii
  • 7,044
  • 14
  • 58
  • 116
0
votes
1 answer

What is the different between Aware interface and @Autowired

In Spring, I can get Spring's objects using Aware interfaces: @Component class TestAware : ApplicationContextAware, EnvironmentAware { override fun setEnvironment(environment: Environment) { println("Server port" +…
cdxf
  • 5,501
  • 11
  • 50
  • 65
0
votes
1 answer

Component Scanning Performance

I'm trying to understand how much time component scanning is adding application context creation. Currently, it takes ~100 seconds to create the application context and I suspect that component scanning for component definitions is costly. I have…
toaler
  • 41
  • 4
0
votes
2 answers

Use abstract Spring bean as constructor-arg

We have a hierarchy of handler classes in our codebase which implement a kind of chain-of-responsibility principle. There is an abstract parent class and it is extended by several child classes, which also receive the abstract in their…
0
votes
1 answer

Autofill Spring map with values, whitch declared in other xml declarations

I have such bean declaration:
PavelPraulov
  • 589
  • 6
  • 18
0
votes
0 answers

Creating Spring Beans with arguments only known at runtime

I have a class that requires parameters provided by the user at runtime. I do this because I like the idea of ensuring the object is always in a valid, ready to use state. However I do not know the parameter values until the user has started using…
TownCube
  • 1,280
  • 1
  • 13
  • 32
0
votes
2 answers

Spring decide bean during runtime

I have multiple provider classes (Provider1 and Provider2), how do I decide what bean I use depending on the input parameter in the Processor class? public class Processor{ private Provider provider; public void process(String …
user5773508
  • 91
  • 1
  • 1
  • 8
0
votes
1 answer

Spring property initialization

I have an xml configurable Spring context with the following property placeholders:
Rahul
  • 1,727
  • 3
  • 18
  • 33
0
votes
1 answer

Spring bean creation flow: how to know when it is finished?

I have a spring application and there is a scheduled logic which produces prototype beans at fixed rate. Everything works fine on my laptop but after deploying it to server my app fails to start due to: 2016-12-13 04:13:01.885 ERROR 4688 ---…
0
votes
1 answer

Getting Spring @Autowired and @postconstuct work

I am trying to introduce a new bean to existing project Current bean is package w.x.y.z.pkgA @Component public class BeanA implements InterfaceA { } And I am trying to add new Bean to w.x.y.z.pkgB package w.x.y.z.pkgB public class BeanB implements…
Dheeraj Joshi
  • 3,057
  • 8
  • 38
  • 55
0
votes
1 answer

Spring + RxJava + Schedule cron job: why beans called only once on connectable observable

I have following code that demonstrates issue: @Component public class App { @Autowired S1 s1; @Autowired S2 s2; int jobs = 0; @Scheduled(cron = "0 * * * * ?") void foo() { System.out.println("schedule cron job: " +…
marknorkin
  • 3,904
  • 10
  • 46
  • 82
0
votes
0 answers

Spring Beans creation and accessing methods

@Service public class SampleClass implements SampleInterface{ @Transactional public void methodA(){ SampleClass bean = ApplicationContext.getBean(SampleClass.class); bean.methodB(); } @Transactional public void…
0
votes
2 answers

Spring dependency injection in external jar

I have a project A which is consuming a jar lets say B.jar (where B is another project used as a dependency in our project A), now there is a Bean (kind of a Spring-gemfire cache), which holds all the required data in a map. This map bean is being…
Amit Kumar Lal
  • 5,537
  • 3
  • 19
  • 37
0
votes
1 answer

Spring MVC 3.0.5.RELEASE get bean from the controller without scan

I have defined this bean: @org.springframework.stereotype.Service(value = "deviceService") public class DeviceServiceImpl implements DeviceService { ... } and this config file