I want to create delete row SQL, but when i run my project, i have error, org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactUsRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Not a managed type: class com.oop2.contactus.model.ContactForm
this my code
ContactUsList.html
<a th:href="@{'/delete-contact-us/'+ ${contactForm.id}}">Delete</a>
MainController.java
@RequestMapping("/delete-contact-us/{id}")
public String deleteContactUs(@PathVariable(name = "id") int id) {
contactService.delete(id);
return "ContactUsList";
}
ContactService.java
public void delete(long id) {
contactRepository.deleteById(id);
}
ContactUsRepository.java
package com.oop2.contactus.repositories;
import com.oop2.contactus.model.ContactForm;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ContactUsRepository extends CrudRepository<ContactForm, Long> {
}