Solved it. So by default, all packages that falls under @SpringBootApplication
declaration will be scanned.
Assuming my main class ExampleApplication
that has @SpringBootApplication
declaration is declared inside com.example.something
, then all components that falls under com.example.something
is scanned while com.example.applicant
will not be scanned.
So, there are two ways to do it based on this question. Use
@SpringBootApplication(scanBasePackages={
"com.example.something", "com.example.application"})
That way, the application will scan all the specified components, but I think what if the scale were getting bigger ?
So I use the second approach, by restructuring my packages and it worked ! Now my packages structure became like this.
src/
├── main/
│ └── java/
| ├── com.example/
| | └── Application.java
| ├── com.example.model/
| | └── User.java
| ├── com.example.controller/
| | ├── IndexController.java
| | └── UsersController.java
| └── com.example.service/
| └── UserService.java
└── resources/
└── application.properties