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
If you mean JPAs @Entity-annotation, Spring is simply telling you, that there isn't a bean in its context. On startup/runtime classes in the application will be scanned and each class annotated with spring annotations like @Component, @Service etc. will be instantiated as beans and put into a global context (Spring applicationcontext). This context is then used to lookup and inject those beans into other beans when @Autowired is found during scanning.
Opposed to this, @Entity is used during the creation of the Persistence-Context of JPA (as far as I remember) which isn't aware of Spring and it's context.
Most of the solutions to make both contexts aware of each other a mostly a little bit hacky.