I am a beginner with spring and angular. I made a controller class in com.test.alex named Search. In my Search class i have this java code:
package com.siemens.cvc.isrules.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class Search {
    @RequestMapping(value = "/getHelloWord", method = RequestMethod.GET)
    public @ResponseBody String getHelloWord(ModelMap model){
        String jsonData ="[{\"salut\":\"Hello Word\"}]";
        return jsonData;
    }
}
Then I have a UI with the following button:
<div class="input-group-addon" ng-click="doSearch();"><span class="glyphicon glyphicon-search"></span></div>
When i press that button, i want to make a request to "/getHelloWord" (Search class) and alert the response.
This is the angularjs controller:
app.controller("search",function($scope,$http){
                    $scope.doSearch = function()
                    {
                        $http({
                            method : 'GET',
                            url : '/ISRulesTool/getHelloWord'
                        }).success(function(data,status,headers,config){
                            alert(data);
                        }).error(function(data,status,headers,config){
                            alert("Request Error");
                        });
                    };
});
And the problem i get is 404. "GET http://localhost:8080/ISRulesTool/getHelloWord 404 (Not Found)"
Where I need to make the request to get the response?
Thank you.
@RestControllerinstead of@Controller, and lose the@ResponseBodyon all your methods. But that's not the problem here. And note that, with AngularJS >= 1.4.4, the use of .success() and .error() is deprecated (see : docs.angularjs.org/api/ng/service/$http).getHelloWorld()and see if it's coming when you hit your GET requesthttp://localhost:8080/ISRulesTool/getHelloWordworking from any REST client in browser ?