-
Oct 11th, 2012, 06:34 PM
#1
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> {
-
Oct 12th, 2012, 01:17 AM
#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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules