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
1 answer

Failing creation of bean in spring

this is the log and this are the entries in my xml file..
vinod
  • 1,178
  • 4
  • 16
  • 42
-1
votes
2 answers

spring IoC: where to put ComponentScan

Here my spring configurer: @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled=true) @Slf4j public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity…
Jordi
  • 20,868
  • 39
  • 149
  • 333
-1
votes
1 answer

Spring Java based configuration advantages over XML based configuration?

I suppose someone should have asked this question given it's been long time since spring has introduced java based config. But as no such result are showing up on SOF, I am take this further. Are there any advantages with Java based configuration…
samshers
  • 1
  • 6
  • 37
  • 84
-1
votes
1 answer

Spring request scoped bean internals

I have been using request scoped beans for my application and I'm curious to know how spring stores those kind of beans in the application context? is there a http reuqest id linked to it? any help/documentation is most welcomed as I did not find…
Sophian Achiba
  • 197
  • 1
  • 13
-1
votes
1 answer

Java Should be a string defined as constant if it being used only at one place

I have a method which uses a String constant as shown below and the value is never used again. @Service public class Sample { public void test(Greet greet) { greet.setInitial("Hi"); } } The value for initial never changes and Sample…
JDev
  • 1,662
  • 4
  • 25
  • 55
-1
votes
1 answer

Is it possible to define to bean with same name in two different namespace without using @Qualifer and @resource

I have two packages and beans as below in spring com.myapp.test1 myService com.myapp.test2 myService part 1:The solution for this situation is giving name for beans like this: @Service(name="myService1") myService and …
Ali Akbarpour
  • 958
  • 2
  • 18
  • 35
-1
votes
1 answer

Should the singleton methods be synchronized?

My web-app (the is no Spring-MVC here, only core IOC) using a lot of prototype beans and most of them are using a singleton dao-bean. Should the singleton dao-bean methods be synhronized since many different prototype beans (from different requests)…
furry
  • 86
  • 9
-1
votes
2 answers

How to use constructor injection in a main program

my question is verry simple: using the constructor injection, how can I get the attributes of a class ClassA declared as attribut in a class ClassB, knowing that the ClassA has just a constructur (no setter and getter)? here i will write my java…
-1
votes
4 answers

What is the best way to implement a component scoped singleton?

Let's say there is an application that creates an instance of the Task class every time when it needs to process some data. The task instance have some other services injected into it but all this services and the task object itself are unique…
-1
votes
2 answers

Spring: Using @Configuration to dynamically return a Bean

Suppose you need to dynamically (at runtime) get an instance of a subtype of a given type. How would you accomplish that using Spring IoC?
Diego Shevek
  • 486
  • 3
  • 15
-2
votes
1 answer

Using Spring DI and Interface default method

Is it safe to use Spring DI + interface default method approach, instead of classic Spring DI + interface + class? @Service public interface MessagesService { default public void send() { } } OR public interface MessagesService { …
Combo
  • 855
  • 2
  • 11
  • 22
-2
votes
1 answer

Why servlet container not preferred over spring IOC container?

Servlet container implements web component contract of Java EE specification, specifying a runtime environment for web components that includes security, concurrency, lifecycle management, transaction, deployment, and other services. Apache tomcat…
overexchange
  • 15,768
  • 30
  • 152
  • 347
1 2 3
12
13