I have a Service which looks like this :
@Service
public class MyService {
private final EntityManager entityManager;
private final SomeBean someBean;
@Autowired
public DbServiceImpl(EntityManager entityManager, SomeBean someBean) {
this.entityManager = entityManager;
this.someBean = someBean;
}
}
I need to annotate the EntityManager
with @PersistenceContext
. How can I do that, while keeping the @Autowired
constructor ?
So the question is, can I annotate the constructor parameter entityManager
separately, while keeping the @Autowired
annotation ?