我正在使用以下博客配置从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)
请帮我解决这个错误.
非常感谢.
我正在获取存储在 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 服务中的客户端。
我想配置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
spring ×2
apache-spark ×1
cassandra ×1
datastax ×1
java ×1
json ×1
rest ×1
restful-url ×1
spring-mvc ×1
spring-rest ×1