小编Ana*_*hna的帖子

从java中的spark访问cassandra时出错:无法导入CassandraJavaUtil

我正在使用以下博客配置从apache spark访问Cassandra.

" http://www.datastax.com/dev/blog/accessing-cassandra-from-spark-in-java "" https://gist.github.com/jacek-lewandowski/278bfc936ca990bee35a#file-javademo-java- L177 "

但是,我无法导入CassandraJavaUtil类依赖项,并且我的eclipse显示错误"导入无法解析".

import static com.datastax.spark.connector.CassandraJavaUtil.*;
Run Code Online (Sandbox Code Playgroud)

请帮我解决这个错误.

非常感谢.

cassandra datastax apache-spark

7
推荐指数
1
解决办法
1530
查看次数

将 JSON 添加到 Spring Rest 控制器中的模型时如何删除转义字符

我正在获取存储在 DB 中的 JSON(JSON 作为字符串存储在 DB 中)并将其添加到控制器中的模型对象中。

@RequestMapping( method = RequestMethod.GET, value = "/all" )
public void getJson(HttpServletRequest httpServletRequest, Model model){

    String json = serviceDao.getResponseJson(); 
    System.out.println(json); //Output: {"Response":[{"Id":"1","Name":"GAD"},{"Id":"2","Name":"GBD"}],"Status":"Success"}
    model.addAttribute("result",json);
}
Run Code Online (Sandbox Code Playgroud)

但是当我从浏览器调用服务时,响应中添加了转义字符。

http://localhost:8080/MyApplication/all.json

{"result":"{\"Response\":[{\"Id\":\"1\",\"Name\":\"GAD\"},{\"Id\":\"2 \",\"名称\":\"GBD\"}],\"状态\":\"成功\"}"}

您能否帮助我在没有转义字符的情况下将 JSON 对象发送到 Web 服务中的客户端。

java rest spring json spring-rest

7
推荐指数
1
解决办法
2万
查看次数

Spring REST请求映射

我想配置Spring将所有请求重定向到特定的Controller,而不管URL(长度和参数).我应该如何在RequestMapping注释中提供URL模式/正则表达式.我尝试使用下面的代码,但它无法正常工作.在这方面的任何帮助深表感谢.

    @Controller
    @RequestMapping("/*")
    public class ServiceController {
        @RequestMapping( method = RequestMethod.GET, value = "*" )
        public void getProjectList(HttpServletRequest httpServletRequest,Model model){

        }
    }
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc restful-url spring-restcontroller request-mapping

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