I am trying to reuse my existing EmployeeRepository code (see below) in two different microservices to store data in two different collections (in the same database).
@Document(collection = "employee")
public interface EmployeeRepository extends MongoRepository<Employee, String>
Is it possible to modify @Document(collection = "employee")
to accept runtime parameters? For e.g. something like @Document(collection = ${COLLECTION_NAME})
.
Would you recommend this approach or should I create a new Repository?