public class TestVO {
	private String name;
	private int age;
	private ArrayList<String> friends;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		if(age > 100 || age < 0) {
			System.out.println("1~100사이의 값을 입력하세요");
			return;
		}
		this.age = age;
	}
	public ArrayList<String> getFriends() {
		return friends;
	}
	public void setFriends(ArrayList<String> friends) {
		this.friends = friends;
	}	
}

Lombok을 사용하여 Getter와 Setter를 만든다.

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
//@NoArgsConstructor
//@Data 권장 X , 일부상황에서 디버깅이 어려워짐
public class TestVO {
	private String name;
	private int age;
	private ArrayList<String> friends;
	
	public void setAge(int age) {
		if(age > 100 || age < 0) {
			System.out.println("1~100사이의 값을 입력하세요");
			return;
		}
		this.age = age;
	}

}

Cross-origin

$.ajax({
		method:"get",
		url:"/sample/suhyen/googleNews" ,
		dataType:"text", //요건 일단 text로 하는 게 디버깅에 유리
        success:function(data){
            console.log(data);
            document.getElementById("disp").innerHTML = data;
        },
        error: function (xhr, status, error) {
        console.log("code: " + xhr.status)
        console.log("message: " + xhr.responseText)
        console.log("error: " + error);
    }
	});
@Controller
@RequestMapping("/suhyen")
@Slf4j /*  롬복이 지원 logger를 따로 안 맹그러도 됌*/
public class MyController {
	@GetMapping(value = "/get")
	public String getName(HttpServletResponse response) {
		return "ajaxTest";

	}
	
	@GetMapping(value = "/googleNews")
	@ResponseBody
	public String getNews(HttpServletResponse response) throws Exception {
		String contents = Request.get("<https://news.google.com/rss/search?q=blackpink>")
	    .execute().returnContent().toString();
		return contents;
	}
}