开发者

Bean Autowiring problem

I am starter in mutithreadin开发者_JS百科g. I am trying to index my data into solr.For that I was writing the following code

I am getting null pointer exception in the line highlighted


You need to add the following:

<context:annotation-config/>

You need to set the path for autowiring package scan and in your case it will be:

<context:component-scan base-package="a.b.c" />

After it you need to mark the class as candidate for autowiring:

@Component("indexTask")
@Scope("prototype")
IndexTask implements Callable<IndexObject>
    {
    //ommited
     }

Next you can remove indexTask bean configuration from xml file. your package will be created automatically.

Hope it helps.


Autowiring doesn't happen automatically, you need to configure it. See the Spring docs for detail, but essentially you need to add

<context:annotation-config/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜