Replies: 3 comments 1 reply
-
The solver tries to auto-detect a constraint provider from your codebase, so that you don't need to explicitly configure one. If you have multiple of them on the classpath, how is the solver supposed to pick? It doesn't know, and therefore it fails. If you want to have both on the classpath, you'll have to provide a solver config to specifically select the constraint provider you want the solver to use. |
Beta Was this translation helpful? Give feedback.
-
To give some more detail on @triceo's comment: the way we have currently documented this is as follows: https://docs.timefold.ai/timefold-solver/latest/integration/integration#integrationWithSpringBootProperties Solver ConfigurationCreate separate solverConfig.xml files. Load them via configuration properties:
Injecting the solverWhen using multiple SolverConfigurations, you need to also add a qualifier to your injection point with the name of the solver.
|
Beta Was this translation helpful? Give feedback.
-
Thank you! @triceo and @TomCools . |
Beta Was this translation helpful? Give feedback.
-
Hi Teams,
I have two ConstraintProvider classes: A_ContraintProvider implements ConstraintProvider and B_ContraintProvider implements ConstraintProvider, I plan to use one of them (through the SolverConfig.winthConstraintExtendeClass() method) to build Solver in different scenarios, but an exception occurs when starting Springboot: Multiple score calculator classes A-ConstraintProvider, B_ConstraintProvider) that implements ConstraintProvider were found in the classpath.
In previous versions, this exception did not appear, and I am not sure which version started it. That is to say, there cannot be more than one ConstraintProvider class in the same project?
Beta Was this translation helpful? Give feedback.
All reactions