相关疑难解决方法(0)

从 Spring Boot 2.7.2 升级到 Spring Boot 3.0.0-SNAPSHOT: java: 包 javax.persistence 不存在

当我使用 Spring Boot 2.7.2 时,一切正常。升级到版本 3.0.0-SNAPSHOT 后,我有

我的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>3.0.0-SNAPSHOT</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>spring_jwt</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <name>spring-boot-security-jwt</name>
    <description>spring_jwt</description>
    <properties>
        <java.version>18</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
            <version>0.11.5</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-impl</artifactId>
            <version>0.11.5</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-jackson</artifactId>
            <version>0.11.5</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId> …
Run Code Online (Sandbox Code Playgroud)

spring jpa spring-boot

14
推荐指数
3
解决办法
3万
查看次数

嵌套异常是java.lang.IllegalArgumentException:不是托管类型:class

我想部署一个Spring-Boot application具有Service访问JpaRepository它连接到PostgreSQL DB在系统运行时JPAHibernate中,指的连接属性src/main/resources/application.properties

当我在Tomcat上部署构建的.WAR时,应用程序无法启动错误日志中给出的错误.

有人可以帮忙解决这个错误的含义吗?

注意:我已经注意到了麻烦点MyServiceImplMyRequestBody类,但我没有得到该错误的确切原因,因为我是新来的Spring框架.

我的Spring Boot Starter项目中相关类的定义如下:

Spring Boot应用程序

@SpringBootApplication
@ComponentScan(<root package name under which all subpackages containing relevant classes >)
public class MySpringBootApplication extends SpringBootServletInitializer {
Run Code Online (Sandbox Code Playgroud)

我的Spring-Boot RestController类(自动装配MyService类实例)

@RestController
public class MyController {

    @Autowired
    MyService myService;
Run Code Online (Sandbox Code Playgroud)

我的服务界面(我没有提供任何@Service注释)

public interface MyService {
    //all service method definitions
}
Run Code Online (Sandbox Code Playgroud)

Spring ServiceImpl类,具有在PostgreSQL DB上运行的自动装配存储库实例

@Service("myService")
public class MyServiceImpl implements MyService {

       @Autowired
       private MyRepository …
Run Code Online (Sandbox Code Playgroud)

spring spring-data spring-data-jpa spring-boot spring-restcontroller

6
推荐指数
1
解决办法
2万
查看次数