问题

升级Spring到3.x后,出现如下问题:

Name for argument of type [java.lang.Long] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the ‘-parameters’ flag.

解决

只需要添加如下配置即可:

<properties>
	<maven.compiler.parameters>true</maven.compiler.parameters>
</properties>

只需要打开这个配置即可。
如果上面配置无效的话,就添加下面的插件配置吧。


<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <compilerArgs>
            <arg>-parameters</arg>
        </compilerArgs>
    </configuration>
</plugin>

总结

如果IDEA调试过程中这个配置没有生效,就先清理一下maven,即:

mvn clean

最后,在重新在IDEA菜单栏中找到Build➡️Rebuild Project 重现构建一下,如下图:
重现构建

参考

Logo

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

更多推荐