

ShedLock报错: Factory method 'proxyScheduledLockAopBeanPostProcessor' threw exc...
source link: https://www.oschina.net/question/1763477_2324646
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ShedLock报错: Factory method 'proxyScheduledLockAopBeanPostProcessor' threw exception???
这个错怎样修复???
Factory method 'proxyScheduledLockAopBeanPostProcessor' threw exception; nested exception is java.lang.NoSuchMethodError
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.javacrumbs.shedlock.spring.aop.MethodProxyScheduledLockAdvisor]: Factory method 'proxyScheduledLockAopBeanPostProcessor' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.support.annotation.AnnotationMatchingPointcut.<init>(Ljava/lang/Class;Ljava/lang/Class;Z)V
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 78 more
Caused by: java.lang.NoSuchMethodError: org.springframework.aop.support.annotation.AnnotationMatchingPointcut.<init>(Ljava/lang/Class;Ljava/lang/Class;Z)V
at net.javacrumbs.shedlock.spring.aop.MethodProxyScheduledLockAdvisor.methodPointcutFor(MethodProxyScheduledLockAdvisor.java:47)
at net.javacrumbs.shedlock.spring.aop.MethodProxyScheduledLockAdvisor.<init>(MethodProxyScheduledLockAdvisor.java:36)
at net.javacrumbs.shedlock.spring.aop.MethodProxyLockConfiguration.proxyScheduledLockAopBeanPostProcessor(MethodProxyLockConfiguration.java:36)
at net.javacrumbs.shedlock.spring.aop.MethodProxyLockConfiguration$$EnhancerBySpringCGLIB$$538e96b6.CGLIB$proxyScheduledLockAopBeanPostProcessor$0(<generated>)
at net.javacrumbs.shedlock.spring.aop.MethodProxyLockConfiguration$$EnhancerBySpringCGLIB$$538e96b6$$FastClassBySpringCGLIB$$98444f76.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at net.javacrumbs.shedlock.spring.aop.MethodProxyLockConfiguration$$EnhancerBySpringCGLIB$$538e96b6.proxyScheduledLockAopBeanPostProcessor(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 79 more
1、build.gradle:
compile "net.javacrumbs.shedlock:shedlock-spring:4.29.0"
compile "net.javacrumbs.shedlock:shedlock-provider-redis-spring-1:4.29.0"
2、配置类:
import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.redis.spring1.RedisLockProvider;
import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
@EnableSchedulerLock(defaultLockAtMostFor = "10m")
@Configuration
public class ShedLockConfig {
@Bean
public LockProvider lockProvider(RedisConnectionFactory connectionFactory) {
return new RedisLockProvider(connectionFactory);
}
}
3、任务类:
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class TimerTask {
private static final Logger logger = LoggerFactory.getLogger(TimerTask.class);
@Autowired
private QuantumSecurity quantumSecurity;
@SchedulerLock(name = "quantum_refresh"
, lockAtLeastFor = "5m"
)
@Scheduled(cron = "0 0 1 * * ?")
public void refresh() {
logger.info("quantum refresh");
}
}
Recommend
-
102
README.md ShedLock
-
12
主要架构选型 Springboot(2.2.2)+Mybatis-Plus(3.0-RC3)+shedLock(4.0.1) 开发注意事项 Q&A 1、 ShedLock 部署时需要创建表 (特别注意不同库创建的sql...
-
10
Lock @Scheduled Tasks With ShedLock And Spring Boot January 12, 2021 As soon as you scale-out your Spring Boot application (run with multiple instances) to e.g. increase throughput or avai...
-
7
19,736 followers
-
7
The Welshman who accidentally threw out 8,000 Bitcoin in 2013 is mounting an $11 million campaign to get it backChris MorrisTue, August 2, 2022, 12:51 AM·2 min rea...
-
6
British engineer who threw away a hard drive holding 7,500 Bitcoin has a new idea on how to recover it from a landfill Robot dogs from Boston Dynamics, AI, and a dash of hope for getti...
-
3
Error 1101 Ray ID: 73ab4b7d4d157821 • 2022-08-14 17:09:06 UTC Worker threw exception ...
-
7
I Threw a Holiday Party in Horizon Worlds. It Didn’t Go WellZuck promised his “metaverse” could bring people together. All I got were glitches and disappointment....
-
5
The brits aren't happy — The UK government just threw a huge wrench in Microsoft’s Activision deal Preliminary report suggests divesting Call of Duty business may...
-
5
Spring中使用分布式任务同步ShedLock 在本文中,了解如何使用 ShedLock 在
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK