Error creating bean with name proxyscheduledlockaopbeanpostprocessor defined in class path resource

这个错怎样修复???
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"); } }

配置文件如下。除了类名不一致以外。别的都是一直的。但是就是报错。求指到。

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:aop="http://www.springframework.org/schema/aop"

    xsi:schemaLocation="http://www.springframework.org/schema/beans

        http://www.springframework.org/schema/beans/spring-beans.xsd

        http://www.springframework.org/schema/aop

http://www.springframework.org/schema/aop/spring-aop-4.0.xsd" >

     <bean id="aspectdome" class="com.main.advice.Aspect">

     </bean>

 <bean id="aspectbiz" class="com.main.advice.biz.AspectBiz">

     </bean>

     <aop:config>

      <aop:aspect id="aspectaop" ref="aspectdome">

      <aop:before method="before" pointcut="execution(* com.main.advice.biz.AspectBiz.*(..))"/>

      </aop:aspect>

     </aop:config>

 </beans>

What is error creating bean with name?

BeanCreationException: Error creating bean with name happens when a problem occurs when the BeanFactory creates a bean. If the BeanFactory encounters an error when creating a bean from either bean definition or auto-configuration, the BeanCreationException will be thrown.

How do you fix bean instantiation through factory method failure?

Solution 1 It is necessary to create a new class that extends the abstract class. If the bean factory is attempting to get the bean by using the abstract class name, it can find and associate the implemented class. The exception would then be resolved.

What is org Springframework beans factory BeanCreationException?

Cause: org.springframework.beans.factory.CannotLoadBeanClassException. Spring throws this exception when it can't load the class of the defined bean. This may occur if the Spring XML Configuration contains a bean that simply doesn't have a corresponding class.

How do I fix Nosuchbeandefinitionexception?

The best solution is to properly isolate beans. The DispatcherServlet is responsible for routing and handling requests so all related beans should go into its context. The ContextLoaderListener , which loads the root context, should initialize any beans the rest of your application needs: services, repositories, etc.