I have a entity class called Customer, I am using this entity object in another class to set the data. When I use this object below like
@Autowired
You can only autowire only those beans whose life-cycle are managed by Spring IoC container.
These beans are defined in xml form with tag, or with some special annotations like @Bean, @Component, @Service, @Repository etc.
On the other hand,
in simple terms, entities are some java objects that you will need to create, update by yourself according to your business logic and save/update/remove them in/from DB. Their life-cycle cannot be managed by Spring IoC container.
So, you should never feel like you need to autowire an entity if you are doing it right!