You have to scan at least the package containing the class you want to inject. For example, with Spring 4 annotation:
@Configuration
@ComponentScan("com.package.where.my.class.is")
class Config {
...
}
It is the same principle for XML configuration.
More Related Contents:
- Unable to complete the scan for annotations for web application [/app] due to a StackOverflowError
- spring Exception when running application on WebSphere with java 8
- Maven- No plugin found for prefix ‘spring-boot’ in the current project and in the plugin groups
- What causes “java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘command’ available as request attribute”?
- @RequestParam vs @PathVariable
- Spring Security : Multiple HTTP Config not working
- Redirect to an external URL from controller action in Spring MVC
- Difference between @Valid and @Validated in Spring
- Spring Boot Multiple Datasource
- Increase HTTP Post maxPostSize in Spring Boot
- Spring MVC type conversion : PropertyEditor or Converter?
- Spring Boot JSP 404
- Configure active profile in SpringBoot via Maven
- Jackson 2.0 with Spring 3.1
- Redirect in Spring MVC
- Maven spring boot run debug with arguments
- Spring MVC – @Valid on list of beans in REST service
- Spring: define @RequestMapping value in a properties file
- How to reload a @Value property from application.properties in Spring? [duplicate]
- Difference between Interceptor and Filter in Spring MVC
- Spring @Value annotation always evaluating as null?
- How to re-create database before each test in Spring?
- Autowiring fails: Not an managed Type
- Spring Partial Update Object Data Binding
- Spring AOP Advice on Annotated Controllers
- logging with AOP in spring?
- Accessing Spring beans from a Tiles view (JSP)
- How to pass a session attribute as method argument (parameter) with Spring MVC
- How to import value from properties file and use it in annotation?
- How to implement @RequestMapping custom properties