Announcement Announcement Module
Collapse
No announcement yet.
Primitive support with @Autowire Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Primitive support with @Autowire

    I can't seem to autowire the following:

    @Autowire public setTimeout(@Timeout int timeoutSeconds){
    this.timeoutSeconds;
    }

    I got a "NoSuchBeanDefinitionException: No unique bean of type [int] is defined: Unsatisfied dependency of type [int]: expected at least 1 matching bean"

    in AutowireAnnotationBeanPostProcessor.postProcessPro pertyValues line 233

    ...(@Timeout Integer ...) works fine.

  • #2
    Integer is something else then int, int is a primitive where as Integer is an object. You use annotations so I assume you use java 5 or later, simply change it to Integer and use the autoboxing features.

    Comment


    • #3
      Originally posted by mdeinum View Post
      Integer is something else then int, int is a primitive where as Integer is an object. You use annotations so I assume you use java 5 or later, simply change it to Integer and use the autoboxing features.
      You're right that Integer is something else then int, and you're right that I could simply use autoboxing.

      However, I am asking that the Spring framework supports @annotation binding Integer/Strings to int parameters in a similar way that it supports conventional int setter methods. IMHO, It seems like a logical addition and a relatively minor pain for the framework.

      Comment

      Working...
      X