ninja is an awesome framework but coming from a spring background, I need to use spring data jpa with ninja.
I want to Autowire a JpaRepository and use it in ninja. Although ninja uses Guice Inject. I keep getting a No implementations found for my class.
the repository:
public interface PortalUserRepository extends JpaRepository<PortalUser, Long> { PortalUser getPortalUserByUsername(String username); PortalUser getPortalUserByEmail(String email); }the injection
public class SetupDaoV2 { @Inject PortalUserRepository portalUserRepository; public void setup() { try { List<PortalUser> portalUsers = portalUserRepository.findAll(); if (portalUsers.size() == 0) { // Create a new user and save it PortalUser portalUser = new PortalUser("lsadjfl", "lsdlfs", "kkk lll", "[email protected]", "lsdlfss@", "[email protected]", new Timestamp(System.currentTimeMillis()), Boolean.TRUE, Boolean.TRUE, GenericStatusConstant.ACTIVE, Boolean.TRUE ); portalUserRepository.save(portalUser); } }catch (Exception ex){ ex.printStackTrace(); } } }the error
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) No implementation for com.bw.dd.dsl.repository.PortalUserRepository was bound.
Well, I finally had to implement the whole thing. A shame I couldn't port the wonderful features from spring data jpa into ninja. I coulda used spring, but for office policy on the project.
If someone finds a way, pls holla.
}