Reputation: 469
I've added optaplanner-spring-boot-starter
dependency on a Spring Boot application but injected SolverManager
and ScoreManager
beans were not found on Intellij.
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method myBusinessBeanAPI in
mypackage.MyRestResource required a bean
of type 'org.optaplanner.core.api.solver.SolverManager' that could not be found.
Action:
Consider defining a bean of type 'org.optaplanner.core.api.solver.SolverManager' in your
configuration.
How can I solve this problem ?
Upvotes: 0
Views: 375
Reputation: 3671
In the documentation, it says In Quarkus and Spring Boot, the SolverManager instance is automatically injected in your code. Otherwise, build a SolverManager instance with the create(…) method:
SolverConfig solverConfig = SolverConfig.createFromXmlResource(".../cloudBalancingSolverConfig.xml");
SolverManager<CloudBalance, UUID> solverManager = SolverManager.create(solverConfig, new SolverManagerConfig());
So probably you didnt import the dependency correctly. If you are using maven and using dependency management config:
<dependencies>
...
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-spring-boot-starter</artifactId>
</dependency>
...
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-spring-boot-starter</artifactId>
<version>7.38.0.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
If you are using gradle:
compile 'org.optaplanner:optaplanner-spring-boot-starter:7.38.0.Final'
Upvotes: 1