Results 1 to 2 of 2

Thread: spring considers setup() function as property

  1. #1

    Default 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 'org.nutch.tools.dbstats.StatMapper': 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;

    @Inject
    private DBStat dbs;

    @Override
    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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •