将java对象返回到javascript时出错

将java对象返回到javascript时出错,javascript,java,json,spring,Javascript,Java,Json,Spring,我正在将java对象返回到客户端(javascript)页面,即将java对象转换为JSON对象,但没有找到返回值错误的转换器。 我已经添加了所有spring jar和jackson-all-xxx.jar。 下面是使用$http.get('url')从html页面调用的方法。 @RequestMapping(value="/springAngularJS",method=RequestMethod.GET) public @ResponseBody Person

我正在将java对象返回到客户端(javascript)页面,即将java对象转换为JSON对象,但没有找到返回值错误的转换器。 我已经添加了所有spring jar和jackson-all-xxx.jar。 下面是使用$http.get('url')从html页面调用的方法。

@RequestMapping(value="/springAngularJS",method=RequestMethod.GET)               
public @ResponseBody Person  getPerson() {  
System.out.println("111111111");  
Person person = new Person();
    person.setFirstName("Java");
    person.setLastName("Honk");
    return person;
    }
我的html页面:(仅发布JS部分) var-app=angular.module('myApp',[])

如能帮助解决此问题,我们将不胜感激。。
我是一名初学者:)

您的问题在于项目依赖性,而不是代码,因为上面的代码是正确的


我再次建议您从Spring boot开始,它将允许您只关注代码

您的问题在于项目依赖性,而不是代码,因为上面的代码是正确的


我再次建议您从Spring boot开始,它将允许您只关注代码

您正在谈论的JSON对象在哪里?如果没有,您是否正在使用Spring boot?如何构建您的项目?@Shahbour。。又是一个新术语springboot:),我使用eclipse,在其中添加了所有必需的jar,并尝试运行这个简单的应用程序better@Shahbour谢谢你的建议。目前,我正在努力学习所有的核心概念。如果你能拿出一些东西来解决我面临的问题,那就太好了。你说的JSON对象在哪里?如果不是的话,你在使用spring boot吗?你是如何构建你的项目的?@Shahbour。。又是一个新术语springboot:),我使用eclipse,在其中添加了所有必需的jar,并尝试运行这个简单的应用程序better@Shahbour谢谢你的建议。目前,我正在努力学习所有的核心概念。如果你能提出一些解决我面临的问题的办法,那就太好了。
function MyController($scope, $http){

    $scope.getPersonDataFromServer = function() {           
        $http.get("springAngularJS").
        success(function(data, status, headers, config) {
            $scope.person = data;
        }).
        error(function(data, status, headers, config) {
          // called asynchronously if an error occurs
          // or server returns response with an error status.
        });

    };
};