Announcement Announcement Module
No announcement yet.
spring considers setup() function as property Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring considers setup() function as property

    i got following error on spring 3.1.2:
    Error: org.springframework.beans.factory.UnsatisfiedDepen dencyException: Error creating bean with name '': Unsatisfied dependency expressed through bean property 'up': Set this property value or disable dependency checking for this bean.

    when i called: springContext.getAutowireCapableBeanFactory().auto wireBeanProperties(o,AutowireCapableBeanFactory.AU TOWIRE_BY_TYPE, true);

    problem is that this bean has no property called up, but there is setup() function, which might be missunderstood by spring as property up. But there is no getup() function.

    Is this bug in spring property detection?

    public class StatMapper extends SpringMapper<Text, CrawlDatum, Text, LongWritable> {
    private LongWritable COUNT_1 = new LongWritable(1);
    private boolean sort = false;

    private DBStat dbs;

    public void setup(Context context) throws IOException, InterruptedException {


    public class SpringMapper <KEYIN, VALUEIN, KEYOUT, VALUEOUT> extends Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> {

    /** spring context support tools */
    protected SpringContextSupport contextSupport;

    public class Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> {

  • #2
    Please use [ code][/code ] tags when posting that way your code remains readable...

    No it is not a spring problem as spring simply delegates to the JDK support for the Java Beans Specification and that mentions methods starting with set/get as property accessor methods (they don't have to be there both you can have read or write only properties I suggest a read of the Java Beans Specification for that). And because you specified that you want to do autowiring all setter methods are considered and should be called.