Smoke logging with Spring java



  • I'm writing a little project, and it's gonna end up like a social network. This is the beginning of work.

    Got a class. Contactcontaining information on the person. Interface ContactDAO, to work with the database and test it with the mop ContactSimpleDAO♪ Service interface ContactServise and its implementation ContactManager

    The whole project is on. https://github.com/SkillsUpCourses/SpringHomeWork/tree/Logging/SpringJavaConfig Trying to finish the logger. Annotations. @AutoLogging above classes which should be logical and written BeanPostProcessor:

    public class AutoLoggingBeanPostProcessor implements BeanPostProcessor {
    
    Map<String, Class> classMap = new HashMap<>();
    private AutoLoggingController loggingController = new AutoLoggingController();
    final Logger logger = LoggerFactory.getLogger(AutoLogging.class);
    
    public AutoLoggingBeanPostProcessor() throws Exception {
        MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
        platformMBeanServer.registerMBean(loggingController, new ObjectName("autologging", "name", "autologger"));
    }
    
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        Class<?> beanClass = bean.getClass();
        if (beanClass.isAnnotationPresent(AutoLogging.class)) {
            classMap.put(beanName, beanClass);
        }
        return bean;
    }
    
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        Class beanClass = classMap.get(beanName);
        if (beanClass != null) {
            return Proxy.newProxyInstance(bean.getClass().getClassLoader(), bean.getClass().getInterfaces(), new InvocationHandler() {
    
                @Override
                public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                    if (loggingController.isEnabled()) {
                        logger.debug("Call method " + method + " with args: " + Arrays.toString(args));
                        Object result;
                        try {
                            result = method.invoke(bean, args);
                            logger.debug("Method " + method + " returns " + result);
                            return result;
                        } catch (Exception e) {
                            logger.error("Method " + method + "threw Exception ", e);
                            throw e;
                        }
                    } else {
                        return method.invoke(bean, args);
                    }
                }
            });
        }
        return bean;
    }
    

    }

    Spring configurations:

    @Configuration
    @PropertySource("classpath:ContactBookMaximumSize.properties")
    @PropertySource("classpath:contacts.properties")
    @ComponentScan(basePackages = {"com.stoxa.springjavaconfig.*"},
    nameGenerator = KsushikBeanNameGenerator.class)
    public class AppConfig {
    @Bean
    public ContactBeanFactory contactBeanFactory() {
    return new ContactBeanFactory();
    }

    @Bean
    public static PropertySourcesPlaceholderConfigurer configurer() {
    return new PropertySourcesPlaceholderConfigurer();
    }
    
    @Value("${maxSize}")
    private int maxContactBookSize;
    
    @Bean
    public ContactDAO dao() throws Exception {
        final ContactSimpleDAO dao = new ContactSimpleDAO();
        Map<String,Contact> contacts = new HashMap<String, Contact>();
        contacts.put(contactBeanFactory().getObject().getPhone(),contactBeanFactory().getObject());
        contacts.put(contactBeanFactory().getObject().getPhone(),contactBeanFactory().getObject());
        contacts.put(contactBeanFactory().getObject().getPhone(),contactBeanFactory().getObject());
        contacts.put(contactBeanFactory().getObject().getPhone(),contactBeanFactory().getObject());
        contacts.put(contactBeanFactory().getObject().getPhone(),contactBeanFactory().getObject());
        dao.setContacts(contacts);
        return dao;
    }
    
    @Bean(initMethod = "init")
    public ContactService contactService() throws Exception {
        ContactManager contactService = new ContactManager();
        contactService.setDao(dao());
        contactService.setMaxContactBookSize(maxContactBookSize);
        return contactService;
    }
    
    @Bean
    public ApplicationEventPublisherAware applicationEventPublisherAware() {
        return new ContactManager();
    }
    
    @Bean
    ApplicationListener<ClearEvent> applicationListener() {
        return new DeleteContactListener();
    }
    
    @Bean
    public AutoLoggingBeanPostProcessor autologgingBeanPostProcessor() throws Exception {
        return new AutoLoggingBeanPostProcessor();
    }
    

    }


    In an attempt to compose a mistake,

    Dec 14, 2015 11:40:09 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
    INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@37a71e93: startup date [Mon Dec 14 23:40:09 EET 2015]; root of context hierarchy
    Dec 14, 2015 11:40:09 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
    INFO: Bean 'appConfig' of type [class com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Dec 14, 2015 11:40:10 PM org.springframework.context.annotation.AnnotationConfigApplicationContext refresh
    WARNING: Exception encountered during context initialization - cancelling refresh attempt
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactService' defined in com.stoxa.springjavaconfig.Config.AppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.Service.ContactService]: Factory method 'contactService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in com.stoxa.springjavaconfig.Config.AppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.DAO.ContactDAO]: Factory method 'dao' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
    at com.stoxa.springjavaconfig.TestClass.TestClass.main(TestClass.java:23)
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.Service.ContactService]: Factory method 'contactService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in com.stoxa.springjavaconfig.Config.AppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.DAO.ContactDAO]: Factory method 'dao' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 13 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in com.stoxa.springjavaconfig.Config.AppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.DAO.ContactDAO]: Factory method 'dao' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.dao(<generated>)
    at com.stoxa.springjavaconfig.Config.AppConfig.contactService(AppConfig.java:69)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.CGLIB$contactService$0(<generated>)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6$$FastClassBySpringCGLIB$$dd5529ed.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.contactService(<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:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 14 more
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.DAO.ContactDAO]: Factory method 'dao' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 35 more
    Caused by: java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
    at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
    at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.enhanceFactoryBean(ConfigurationClassEnhancer.java:402)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:301)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.contactBeanFactory(<generated>)
    at com.stoxa.springjavaconfig.Config.AppConfig.dao(AppConfig.java:57)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.CGLIB$dao$5(<generated>)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6$$FastClassBySpringCGLIB$$dd5529ed.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.dao(<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:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 36 more

    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactService' defined in com.stoxa.springjavaconfig.Config.AppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.Service.ContactService]: Factory method 'contactService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in com.stoxa.springjavaconfig.Config.AppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.DAO.ContactDAO]: Factory method 'dao' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:84)
    at com.stoxa.springjavaconfig.TestClass.TestClass.main(TestClass.java:23)
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.Service.ContactService]: Factory method 'contactService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in com.stoxa.springjavaconfig.Config.AppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.DAO.ContactDAO]: Factory method 'dao' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 13 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in com.stoxa.springjavaconfig.Config.AppConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.DAO.ContactDAO]: Factory method 'dao' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.dao(<generated>)
    at com.stoxa.springjavaconfig.Config.AppConfig.contactService(AppConfig.java:69)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.CGLIB$contactService$0(<generated>)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6$$FastClassBySpringCGLIB$$dd5529ed.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.contactService(<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:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 14 more
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.stoxa.springjavaconfig.DAO.ContactDAO]: Factory method 'dao' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 35 more
    Caused by: java.lang.IllegalArgumentException: Cannot subclass final class class com.sun.proxy.$Proxy14
    at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
    at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
    at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.enhanceFactoryBean(ConfigurationClassEnhancer.java:402)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:301)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.contactBeanFactory(<generated>)
    at com.stoxa.springjavaconfig.Config.AppConfig.dao(AppConfig.java:57)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.CGLIB$dao$5(<generated>)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6$$FastClassBySpringCGLIB$$dd5529ed.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:318)
    at com.stoxa.springjavaconfig.Config.AppConfig$$EnhancerBySpringCGLIB$$ade870a6.dao(<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:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 36 more

    Please help me figure this out.



  • Anyway, your problem is, you're calling the method. contactBeanFactory inside @Bean- Meta dao()♪ Or that you're a substitute. ContactBeanFactory to proxy AutoLoggingBeanPostProcessorto choose. Get the annotations off. ContactBeanFactory and he'll stop flying.

    I don't know, I found this mask on the construction.

    Judging by https://jira.spring.io/browse/SPR-6602 ♪ When you did @ConfigurationgetSomethingFactoryBean().getObject() returns different objects every time, which does not coincide with the conduct of xml-configuration. That's why they came up with the challenge. @Bean- the meta returning FactoryBean Explore the result to the result getObject() I returned the bin. Since you've already created a proxy, which is final-grade, you can't do another sub class, and it's falling.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2