@Controller
@RequestMapping ("/andy")
public class helloContoller {
@Autowired
private PayService payService;
@Autowired
private Resource resource;
@Autowired
private Person person;
@RequestMapping ("/hello2")
@ResponseBody
public Person hello2(){
person.setAge("132");
person.setName("andy");
return person;
}
}
返回会报:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.springframework.context.expression.StandardBeanExpressionResolver and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.example.controller.Resource$$EnhancerBySpringCGLIB$$397134d0["$$beanFactory"]->org.springframework.beans.factory.support.DefaultListableBeanFactory["beanExpressionResolver"])