您好,我想尝试从我的存储库接收数据,但我什么也检索不到。我在 java 类中自动装配:“ src/main” 它有效但在 junit 测试中没有
我已经尝试过 Jpa 存储库的任何方法,但我总是收到一个“空”参数
Junit类
@RunWith(SpringJUnit4ClassRunner.class)
@DataJpaTest
class testClass {
@Autowired
private TestEntityManager entityManager;
@Autowired
private ClienteRepository clienteRepository;
@Test
public void test() {
List<ClienteEntity> cliente = clienteRepository.findAll();
System.out.println(cliente);
}
资料库
@Repository
public interface ClienteRepository extends JpaRepository<ClienteEntity, Integer>{
ClienteEntity findByEmail(@Param("email") String email);
在控制台中使用 system.out.printl 控制台我总是有这个输出:
Hibernate: select clienteent0_.id as id1_0_, clienteent0_.cap as cap2_0_, clienteent0_.citta as citta3_0_, clienteent0_.cognome as cognome4_0_, clienteent0_.email as email5_0_, clienteent0_.indirizzo as indirizz6_0_, clienteent0_.nome as nome7_0_, clienteent0_.password as password8_0_, clienteent0_.token as token9_0_ from cliente clienteent0_
[]
a empty list of ClientEntity
qq_笑_17
慕容森
qq_遁去的一_1
相关分类