项目场景:

提示:这里简述项目相关背景:
项目版本升级。升级到jdk21和 spring6.1.1和springboot3.1.6 在访问过程中会有问题 报错:Name for argument of type [java.lang.Long] not specified, and parameter name information not found in class file either.
在这里插入图片描述

原因分析:

应该是插件版本适配的问题 !

原本插件是

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<version>3.5.1</version>
	<configuration>
		<source>21</source>
		<target>21</target>
		<encoding>${file_encoding}</encoding>
		<skip>true</skip>
	</configuration>
</plugin>

但是我们升级过springboot版本之后spring-boot-start-parent给适配的是3.11版本

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>3.1.6</version>
      <type>pom</type>
  </dependency>

在这里插入图片描述
所以最好不要自己去指定版本号。


解决方案:

指定springboot指定的版本号
or
去掉版本号

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.11.0</version>
    <configuration>
        <parameters>true</parameters>
        <source>21</source>
        <target>21</target>
    </configuration>
</plugin>

在这里插入图片描述

参考的其他博客!

链接: 升级springboot3.2.0报Name for argument of type [java.lang.String] not specified, and parameter name inf

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐