Previously, when using springboot to develop the system, the @Resouse annotation was used. There was no exception during the idea runtime, but the jar package conflict was reported when the deployment was packaged.
09:07:51.234 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - [report,40] -
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.<init>(CommonAnnotationBeanPostProcessor.java:664)
The following method did not exist:
'java.lang.String javax.annotation.Resource.lookup()'
The method's class, javax.annotation.Resource, is available from the following locations:
jar:file:/C:/vic/vic-admin.jar!/BOOT-INF/lib/jsr250-api-1.0.jar!/javax/annotation/Resource.class
jar:file:/C:/vic/vic-admin.jar!/BOOT-INF/lib/jakarta.annotation-api-1.3.5.jar!/javax/annotation/Resource.class
The class hierarchy was loaded from the following locations:
javax.annotation.Resource: jar:file:/C:/vic/vic-admin.jar!/BOOT-INF/lib/jsr250-api-1.0.jar!/
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.annotation.Resource
Reason:
jsr250-api-1.0.jar and jakarta.annotation-api-1.3.5.jar are duplicated
Solution:
Import the following dependency in the pom of Maven. the codes is as below:
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
The purpose of this is to make the system automatically import the latest jar package