I'm doing a Spring/Hibernate MVC CRUD project (which can be found here: https://github.com/Benjamin-Re/customer-tracker-demo/tree/main/web-customer-tracker1/src/base_package/de/entity). In the servlet I declare the base-package to be scanned. However it does not scan the sub-packages. I receive the error that my entity "is not mapped".
org.hibernate.hql.internal.ast.QuerySyntaxException: Customer is not mapped [from Customer]
I specified only the entity package to be scanned and the error goes away. But then the other packages are not scanned for beans and so no mapping can be found.
I tried to list the sub packages like this:
<context:component-scan base-package="base_package.de.entity, base_package.de.controller, base_package.de.dao, base_package.de.service" />
But the Entity is not found. I get the same error.
I also tried to list them like this:
<context:component-scan base-package="'base_package.de.entity', 'base_package.de.controller', 'base_package.de.dao', 'base_package.de.service'" />
Here I don't get an error but a warning: No mapping for GET /web-customer-tracker1/customer/list. So I guess it can't find the controller.
I then tried to put all classes directly in one package. I then receive the error: Error creating bean with name 'customerController': Unsatisfied dependency expressed through field 'customerService' So here now it doesn't find the customerService bean. As you can see each bean has the correct annotation @Entity, @Controller, @Repository, @Service. I checked the imports and they are org.springframework.stereotype.
What am I doing wrong here? Any input would be greatly appreciated.
