How Can I use Camunda with JpaRepository?

How Can I use Camunda with JpaRepository?

I am new to Camunda.

I have a project using JpaRepository worked well earlier without Camunda。

And I want add Camunda in it.

I am using camunda-bpm-run-7.20.0 and camunda-modeler-5.21.0-win-x64 for my workflow development.

I adjusted the pom.xml.

And it cannot run now.

I do not know how to fix it.

The following is the pom.xml file.

<?xml version="1.0" encoding="UTF-8"?>


4.0.0

org.springframework.boot
spring-boot-starter-parent
2.2.2.RELEASE




com.myexample
workflow
0.0.1-SNAPSHOT
workflow
Demo project for Spring Boot

<properties>
    <java.version>17</java.version>
</properties>



<dependencies>
    <dependency>
        <groupId>org.camunda.bpm.springboot</groupId>
        <artifactId>camunda-bpm-spring-boot-starter</artifactId>
        <version>7.20.0</version>
    </dependency>
    <dependency>
        <groupId>org.camunda.bpm.springboot</groupId>
        <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
        <version>7.20.0</version>
    </dependency>
    <dependency>
        <groupId>org.camunda.bpm.springboot</groupId>
        <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
        <version>7.20.0</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-launcher</artifactId>
        <version>1.5.2</version> <!-- 确认这个版本是否存在 -->
    </dependency>
</dependencies>

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

Hello sxc.

What do you mean by how can you use Camunda with JpaRepository?

Could you provide me the log you get when you run the project?

By the information you are sharing right now I think the problem is the version of Camunda you are using as your dependency or your java version might conflict with it.

Hello,I have send my second topic which is now in pending.

And I think it is really the problem the version of Camunda I am using as my dependency or my java version might conflict with it.

I am using JAVA SDK 17.

my second topic is the following

How Can I combine Springboot+camunda7.20.0+mysql ?

I am new to Camunda.

I want to make a project using Springboot+camunda7.20.0+ MySQL。

I am using camunda-bpm-run-7.20.0 and camunda-modeler-5.21.0-win-x64 for my workflow development.The MySQL version is 8.0.28.

Can anyone give me an example running on IDEA?

Especially the pom.xml file and application.yaml for me to practice?

Thanks a lot in advance.

the pom.xml file is

<?xml version="1.0" encoding="UTF-8"?>


4.0.0

org.springframework.boot
spring-boot-starter-parent
3.1.1


com.example
My20240518CSM
0.0.1-SNAPSHOT
My20240518CSM
My20240518CSM

<java.version>17</java.version>




javax.persistence
javax.persistence-api
2.2


org.springframework.boot
spring-boot-starter-data-jpa



org.springframework.boot
spring-boot-starter-jdbc


org.springframework.boot
spring-boot-starter-web


com.mysql
mysql-connector-j
runtime


org.projectlombok
lombok
true


org.springframework.boot
spring-boot-starter-test
test

        <groupId>org.camunda.bpm.springboot</groupId>

        <artifactId>camunda-bpm-spring-boot-starter</artifactId>

        <version>7.20.0</version>

    </dependency>

    <dependency>

        <groupId>org.camunda.bpm.springboot</groupId>

        <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>

        <version>7.20.0</version>

    </dependency>

    <dependency>

        <groupId>org.camunda.bpm.springboot</groupId>

        <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>

        <version>7.20.0</version>

    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <image>
                    <builder>paketobuildpacks/builder-jammy-base:latest</builder>
                </image>
                <excludes>
                    <exclude>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                    </exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>

and the error message is
2024-05-21T15:39:02.440+08:00 ERROR 34344 — [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘borrowedRepository’ defined in com.example.my20240518csm.repository.BorrowedRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Not a managed type: class com.example.my20240518csm.entity.Borrowed

Now I do not know how to solve the problem.
Can anyone with kindness help me?
Thanks a lot in advance.