Tarik Ouhamou
Tarik Ouhamou

Reputation: 427

Spring boot optaplanner autowiring problem

Hello this is my first time using optaplanner library in spring boot, so i've entered my dependencies in my pom.xml and when i run it i get an error saying that some classess generated by the jar cannot be injected the following is my pom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema- 
   instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven- 
  4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.2</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
    <java.version>1.8</java.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.optaplanner</groupId>
        <artifactId>optaplanner-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.optaplanner</groupId>
            <artifactId>optaplanner-spring-boot-starter</artifactId>
            <version>8.2.0.Final</version>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

But when i try to run my project i get this error

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 
'solverManager' defined in class path resource 
[org/optaplanner/spring/boot/autoconfigure/OptaPlannerAutoConfiguration.class]: Unsatisfied 
dependency expressed through method 'solverManager' parameter 0; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 
'solverFactory' defined in class path resource 
[org/optaplanner/spring/boot/autoconfigure/OptaPlannerAutoConfiguration.class]: Unsatisfied 
dependency expressed through method 'solverFactory' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solverConfig' 
defined in class path resource 

Any help is appreciated.

Upvotes: 0

Views: 92

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27312

Check how your project differs from the optaplanner spring boot quickstart.

Upvotes: 1

Related Questions