Q:

Spring Cloud Data Flow @EnableBinding annotation breaks constructor injection

I am trying to create a bean using constructor injection and annotate it with Spring Cloud @EnableBinding annotation.
I am using Spring Boot 1.3.3 and Spring Cloud Brixton.M5.
I receive the following exception during app startup:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'locationReceiver' defined in file [<path>/projects/location/location-microservice/target/classes/<xxx>/location/microservice/stream/LocationReceiver.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [xxx.location.microservice.stream.LocationReceiver$$EnhancerBySpringCGLIB$$b2012a14]: No default constructor found; nested exception is java.lang.NoSuchMethodException: xxx.location.microservice.stream.LocationReceiver$$EnhancerBySpringCGLIB$$b2012a14.<init>()
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) [spring-boot-1.3.3.RELEASE.jar:1.3.3.RELEASE]
    at xxx.location.microservice.LocationMicroservice.main(LocationMicroservice.java:13) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.3.3.RELEASE.jar:1.3.3.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [xxx.location.microservice.stream.LocationReceiver$$EnhancerBySpringCGLIB$$b2012a14]: No default constructor found; nested exception is java.lang.NoSuchMethodException: xxx.location.microservice.stream.LocationReceiver$$EnhancerBySpringCGLIB$$b2012a14.<init>()
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:85) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1098) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 22 common frames omitted
Caused by: java.lang.NoSuchMethodException: xxx.location.microservice.stream.LocationReceiver$$EnhancerBySpringCGLIB$$b2012a14.<init>()
    at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_72]
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[na:1.8.0_72]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 23 common frames omitted

This exception disappears if

@EnableBinding is removed
No-args constructor is introduced (obviously, it's used then despite @Autowired annotation on constructor containing args)
Field injection is used instead

Code snippet below:
@EnableBinding(Sink.class)
public class LocationReceiver {
//    @Autowired
    private final LocationModelRepository repository;

//    LocationReceiver() {
//        repository = null;
//    }

    @Autowired
    public LocationReceiver(LocationModelRepository repository) {
        this.repository = repository;
    }
}

I guess it's related somehow to CGLIB proxy, but it should support constructor injection starting from Spring 4.
Does anybody has an idea what's wrong? Is it my fault or it's a bug in Spring Cloud Data Flow?

A:

Just got an answer from Dave Syer on github:

That's because @EnableBinding is a @Configuration (and until Spring
  4.3 constructor injection doesn't work with @Configuration).

