小编Jur*_*raj的帖子

SpringBoot @RestController,找到了不明确的映射

嗨,我的Sample中有一个简单的RestController:

@RestController
public class PersonController {

    @RequestMapping(name = "/getName", method = GET)
    public String getName() {
        return "MyName";
    }

    @RequestMapping(name = "/getNumber", method = GET)
    public Double getNumber(){
        return new Double(0.0);
    }
}
Run Code Online (Sandbox Code Playgroud)

我有SampleController用于启动SpringBoot:

@SpringBootApplication
@Controller
public class SampleController {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(SampleController.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试运行SampleCotroller时,会发生以下异常:

Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'personController' bean method 
public java.lang.Double com.web.communication.PersonController.getNumber()
to {[],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'personController' bean method
public java.lang.String com.web.communication.PersonController.getName() mapped.
Run Code Online (Sandbox Code Playgroud)

问题出在哪里?一个RestController中不能有更多的RequestMappings? …

rest spring controller ambiguous-call spring-boot

9
推荐指数
1
解决办法
6763
查看次数

来自 CSV 的 Hive 表。引号中的行终止

我尝试从保存到 HDFS 的 CSV 文件创建表。问题是 csv在引号内包含换行符。CSV 中的记录示例:

ID,PR_ID,SUMMARY
2063,1184,"This is problem field because consists line break

This is not new record but it is part of text of third column
"
Run Code Online (Sandbox Code Playgroud)

我创建了蜂巢表:

CREATE TEMPORARY EXTERNAL TABLE  hive_database.hive_table
(   
    ID STRING,
    PR_ID STRING,
    SUMMARY STRING 
)
row format serde 'com.bizo.hive.serde.csv.CSVSerde'
with serdeproperties (
    "separatorChar" = ",",
    "quoteChar"     = "\"",
    "escapeChar"  = "\""
)     
stored as textfile
LOCATION '/path/to/hdfs/dir/csv'
tblproperties('skip.header.line.count'='1');
Run Code Online (Sandbox Code Playgroud)

然后我尝试计算行数(正确的结果应该是 1)

Select count(*) from hive_database.hive_table;
Run Code Online (Sandbox Code Playgroud)

但结果是 4 what 是不正确的。你知道如何解决它吗?谢谢大家。

hadoop hive opencsv

4
推荐指数
1
解决办法
6815
查看次数

标签 统计

ambiguous-call ×1

controller ×1

hadoop ×1

hive ×1

opencsv ×1

rest ×1

spring ×1

spring-boot ×1