Create a DataTableConfig File:
@Configuration @EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class, basePackages ="com.spring.demo.datatableRepository" ) public class DataTablesConfiguration { }
Create a rest controller as :
Now any repo I call are returning Nullpointerexception it was working fine earlier but dont know why. I tried setting the @EnableJpaRepositories(basePackages = "com.spring.demo.dao") in the spring boot App file. In DAO other repositories are there. which are also returning null now.
Interface extends DataTableRepo as specified
public interface UserDataTableRepo extends DataTablesRepository<User,Integer> {}
Struggling with this since last day.
I have configured all according to documentation
Create a DataTableConfig File:
@Configuration @EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class, basePackages ="com.spring.demo.datatableRepository" ) public class DataTablesConfiguration { }
Create a rest controller as :@JsonView(DataTablesOutput.View.class) @RequestMapping(value = "/get_data", method = RequestMethod.POST) public DataTablesOutput<User> listPOST(@Valid @RequestBody DataTablesInput input) throws Exception{ System.out.println("DATA POST HERE:==>"+input); try { DataTablesOutput<User> adt = userDataTableRepo.findAll(input); // returns nullpointer exception System.out.println("DATA adt HERE:==>"+adt); System.out.println(adt); return adt; }catch (Exception e){ e.printStackTrace(); System.out.print("eer"); } return new DataTablesOutput<>(); }
Now any repo I call are returning Nullpointerexception it was working fine earlier but dont know why. I tried setting the
@EnableJpaRepositories(basePackages = "com.spring.demo.dao")
in the spring boot App file. In DAO other repositories are there. which are also returning null now. Interface extends DataTableRepo as specifiedpublic interface UserDataTableRepo extends DataTablesRepository<User,Integer> {}
Struggling with this since last day.