'@ComponentScan in Spring (not Boot) doesn't scans subpackages
My project is situated in package home.bank_application. There are a lot of subpackages, such as 'controller', 'dao', 'service', 'config' etc...
When I annotated my WebConfigClass as @ComponentScan(basePackages = "home.bank_application") my subpackages aren't scaned.
When I annotated my WebConfigClass as @ComponentScan(basePackages = {"home.bank_application.controller", "home.bank_application.dao","home.bank_application.service", "home.bank_application.config"}), all these packages are scaned fine.
But when I annotated my WebConfigClass as @ComponentScan(basePackages = "home.bank_application") my subpackages aren't scaned.
What is the problem?
Solution 1:[1]
I found the solution of this problem.
@ComponentScan(basePackages = "home.bank_application")
and
@ComponentScan(basePackages = "home.bank_application.*")
NOT the same things.
All problem was in * in the end of path!!!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
