1. 在pom中添加jackson依赖
 <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
  1. 添加@ResponseBody返回对象即可
@RequestMapping("public")
	@ResponseBody
	public Message everyone()
	{
		String message="success! this API is for everyone authenticated";
		Message m=new Message();
		m.setMessage(message);
		return m;
		
	}