Error creating bean with name ‘entityManagerFactory’ defined in class path resource

Resolved this error by adding a Bean to the main application class.
@Bean(name=“entityManagerFactory”)
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
return sessionFactory;
}