After many years working with multilayer architectures, the best practice is to group the classes in a way that is meaningful to you and your developers. See the following example:
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── mycompany
│ │ │ └── myproject
│ │ │ └── mymodule
│ │ │ ├── Application.java
│ │ │ ├── data
│ │ │ │ ├── bo
│ │ │ │ │ ├── Account.java
│ │ │ │ │ ├── Customer.java
│ │ │ │ │ ├── User.java
│ │ │ │ └── repository
│ │ │ │ ├── AccountRepository.java
│ │ │ │ ├── CustomerRepository.java
│ │ │ │ └── UserRepository.java
│ │ │ ├── exception
│ │ │ │ ├── DuplicatedRecordException.java
│ │ │ │ ├── NoResultException.java
│ │ │ │ └── UnknownErrorException.java
│ │ │ ├── web
│ │ │ │ └── controller
│ │ │ │ ├── AccountController.java
│ │ │ │ ├── CustomerController.java
│ │ │ │ └── UserController.java
│ │ │ └── service
│ │ │ ├── AccountService.java
│ │ │ ├── CustomerService.java
│ │ │ └── UserService.java
│ │ └── resources
│ │ ├── application.yml
│ │ ├── bootstrap.yml
│ │ ├── logback-spring.xml
│ │ └── messages
│ │ ├── message_es.properties
│ │ └── message.properties
The previous example group classes in packages by:
BO (Business Object)
Entities that represents data
Exception
Your custom exception classes
Web Controller If you are going to build rest all your controllers should be here.
Service
Your services classes if needed.
Resources
All your application resources