• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Spring multithreading question

 
Ranch Hand
Posts: 666
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an interesting problem

I have a service and this service calls into a database via SpringData CrudRepository.


so I have the following code that works



I have a service MatchingProcessingImpl that autowires in the repostory



This also works

But now I have made  MatchingProcessingImpl a callable. so I can call multiple of this service, which then calls accountRepository.

Now I know @Autowired is not threadable, so is there another way to autowire in a service that is threadable

Thanks for any help


 
Tony Evans
Ranch Hand
Posts: 666
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok whatI did to get around the problem is I autowired my repo in the calling service, that calls the service that i wish to run as a thread, and then passed the repo as a parameter into the threaded service
 
reply
    Bookmark Topic Watch Topic
  • New Topic