Skip to content
Advertisement

Tag: executor

Spring boot JPA repository passed to another thread not working

I have an autowired jpa repository object working. However, I need to use it to add rows into the database from multiple threads. Though, after passing it to another thread, it fails. Code structure However, doing a dbRepository.save() from a thread safe class, I get error cause: java.lang.IllegalStateException: org.springframework.context.annotation.AnnotationConfigApplicationContext@41330d4f has been closed already detailedMessage: Error creating bean with name ‘spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties’:

Advertisement