I have a question in regards to passing objects into methods that don't directly use the object, but pass them to other methods. This object requires a spring bean. Is this a bad idea and a sign of a design problem? In the code below ExpeditionEntitiesService is the object which requires the spring bean (BcidService). Do you have any suggestions on how I can make this code better?
Here is a REST service which uploads a file:
The next class is used to convert the file to triples to be stored in Apache fuseki TBD:
The next class is used by the Triplifier to generate the mapping file used to create the triples:
The next class is used to get the unique persistent identifier for the triples. Here is where I need the spring bean (BcidService):
Can you show us only the code where you have the problem, I can't figure out which Spring bean you are passing to another method. Just remove the irrelevant code (like file creation code, methods which don't have anything to do with the design problem etc).
I never had to pass a Spring bean to another method because my Spring beans interact with other Spring beans. So if the other Spring bean which I'm calling also depends on another bean it can get it injected. So in your case when you are passing a Spring bean to another object, can you make that object a Spring bean? If you are creating new object because you need a new object with each request or user, then you can declare your spring bean with different scopes like Request or Session or Prototype...