When using constructor injection, what is the correct way of injecting the persistence context ?
Both of these solution makes my integration test pass, so looks like EntityManager
is injected correctly, but I am not sure about the difference.
@AllArgsConstructor
@Service
@Slf4j
public class StockService {
    private StockRepo stockRepo;
    private IndexRepo indexRepo;
    private EntityManager entityManager;
...
}
or
@AllArgsConstructor
@Service
@Slf4j
public class StockService {
    private StockRepo stockRepo;
    private IndexRepo indexRepo;
    @PersistenceContext
    private EntityManager entityManager;
...
}
