[ 
https://issues.apache.org/jira/browse/FELIX-3812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13529752#comment-13529752
 ] 

Daan de Wit commented on FELIX-3812:
------------------------------------

Property injection does work, but not for constructor arguments.

I tried both versions. My code is like this:
{code:java}
@Component
@Provides
public class Hello2Command implements Command {
        private String msg;
        
        public Hello2Command(@Property String msg) {
                System.out.println("Hello2Command ctor");
                this.msg = msg;
        }
        
        @Override
        public void execute(String args, PrintStream out, PrintStream err) {
                out.println("Hello " + msg + "!");
        }

        @Override
        public String getName() {
                return "hello2";
        }

        @Override
        public String getShortDescription() {
                return "Says hello";
        }

        @Override
        public String getUsage() {
                return getName();
        }
}
{code}
                
> constructor injection does not work for properties
> --------------------------------------------------
>
>                 Key: FELIX-3812
>                 URL: https://issues.apache.org/jira/browse/FELIX-3812
>             Project: Felix
>          Issue Type: Bug
>          Components: iPOJO
>    Affects Versions: ipojo-core-1.8.2, ipojo-core-1.8.4
>            Reporter: Daan de Wit
>
> Constructor injection does not work for properties, iPOJO tries to find a 
> constructor that also has an InstanceManager-argument. 
> createInstance -> Cannot invoke the constructor (method not found) : 
> package.ClassName.<init>(org.apache.felix.ipojo.InstanceManager, null)
> java.lang.NoSuchMethodException: 
> package.ClassName.<init>(org.apache.felix.ipojo.InstanceManager, null)
>       at java.lang.Class.getConstructor0(Class.java:2706)
>       at java.lang.Class.getDeclaredConstructor(Class.java:1985)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to