Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring-boot default EntityManager

Does spring-boot have a default EntityManager. I am setting one up right now but I noticed when my project loads I see this:

LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'

Is this a default EntityManager and if so, how do I access it?

Thank you in advance.

like image 363
Alert1201 Avatar asked May 03 '26 09:05

Alert1201


1 Answers

You can use the @PersistenceContext annotation to inject the entity manager into your spring beans:

@PersistenceContext
EntityManager em;
like image 178
David SN Avatar answered May 06 '26 12:05

David SN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!