Top "Autowired" questions

Autowiring is a DI container feature where the dependencies are automatically looked for according to some criteria.

How does Spring annotation @Autowired work?

I came across an example of @Autowired: public class EmpManager { @Autowired private EmpDao empDao; } I was curious about how the …

spring dependency-injection autowired
How to set @Autowired constructor params as "required=false" individually

I'm using the @Autowired annotation under a @Configuration class constructor. @Configuration public class MyConfiguration { private MyServiceA myServiceA; private MyServiceB myServiceB @…

spring spring-boot constructor autowired
@Autowired and @Service working from controller but not from a different package

I need help understanding the concept behind @Autowired and @Service. I have a DAO defined with @Service and controller with @…

java spring-mvc spring-3 autowired
Spring Dependency Injection Autowiring Null

I was able to use RestTemplate and autowire it. However I want to move my rest template related part of …

java spring dependency-injection autowired
2 beans with same name but in different packages; how to autowire them?

I have an application that has 2 beans with the same name, but which are in different packages. My Spring application …

spring inversion-of-control autowired
How do I manually autowire a bean with Spring?

I have a bean B which I have to create myself (using new B()) and which has @Autowire and @PostConstruct …

java spring autowired
Spring dependency injection with @Autowired annotation without setter

I'm using Spring since a few months for now, and I thought dependency injection with the @Autowired annotation also required …

java spring dependency-injection autowired
How do I inject a logger into a field in the sample spring boot application?

What I want is to make spring autowire a logger. So, in other words, I want to have this working: …

java spring logging spring-boot autowired
How to make instance of CrudRepository interface during testing in Spring?

I have a Spring application and in it I do not use xml configuration, only Java Config. Everything is OK, …

java xml spring spring-mvc autowired
Spring @Autowired on a class new instance

I'm not so familiar with Spring and I have the following situation: A repository class: @Repository public class MyRepository { // ... } A …

java spring dependency-injection autowired