简体   繁体   English

Spring-Hadoop使用mapper类中的spring对象

[英]Spring-Hadoop use spring object from mapper class

I use spring-hadoop version 1. I am trying to use a Spring initialized singleton from the mapper class. 我使用的是spring-hadoop版本1。我正在尝试使用来自mapper类的Spring初始化的单例。

The start of the class is listed below 该课程的开始在下面列出

public class Map extends
    Mapper<LongWritable, Text, Text, IntWritable> 


@Autowired 
MyObject myObject;

The problem is that it is not initialized. 问题是它没有被初始化。 I checked also in the log of spring that the myObject bean is initialized but it is not autowired. 我也查了日志弹簧,该myObject的bean被初始化,但它不自动装配。

After searching the web i found the link 搜索网络后,我找到了链接

http://forum.springsource.org/showthread.php?128572-Using-spring-context-in-mapper-how-to-autowire http://forum.springsource.org/showthread.php?128572-Using-spring-context-in-mapper-how-to-autowire

I did not understand what the solution was there. 我不明白那里的解决方案。

MyObject是任何一种服务还是只是普通的Java bean。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM