Top "Autowired" questions

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

@Autowired HttpServletResponse

I'm looking for a way to autowire HttpServletResponse. It doesn't work with spring out of the box, but I've found …

java spring spring-mvc autowired
Spring 3.2 annotation autowiring with multiple constructors

Spring docs: Only one annotated constructor per-class can be marked as required, but multiple non-required constructors can be annotated. If …

spring constructor autowired required
Spring 3.2 Autowire generic types

So I have a number of generics in Spring 3.2 and ideally my architecture would look something like this. class GenericDao&…

java generics spring-mvc inversion-of-control autowired
what is the difference between request and session scope in spring?

In request scope, a bean is defined to an HTTP request whereas in session scope, it is scoped to an …

spring session dependency-injection request autowired
Autowiring of beans generated by EasyMock factory-method?

I have a problem that seems really strange to me. I have the following setup: An interface: package com.example; …

java spring easymock autowired factory-method
Using @Autowired with AspectJ and Springboot

I want to use @Autowired annotation into an "Aspect". I want to inject a repository in my aspect but when …

java spring aspectj autowired spring-boot
Is it possible to use @Resource on a constructor?

I was wondering if it possible to use the @Resource annotation on a constructor. My use case is that I …

java spring autowired spring-annotations
Clean code - Where should @Autowired be applied?

I'll start with a simple example. You have a Spring boot application that runs a CommandLineRunner class on initialization. // MyCommandLineRunner.…

java spring spring-boot coding-style autowired
How to mock a autowired list of Spring beans?

I've read plenty of articles about how to mock Spring's bean and their autowired fields. But there is nothing I …

java spring unit-testing mockito autowired
Autowiring a service into a validator

This example is a bit contrived; I've simplified it to remove extraneous details and to focus on the problem I …

spring validation hibernate-validator autowired spring-3