我有一个Person类: @Entity public class Person { @Id @GeneratedValue private Long id; @ManyToMany(fetch = FetchType.LAZY) private List<Role> roles; // etc } 与多对多的关系是懒惰的。 在我的控制器中 @Controller @RequestMapping("/person") public class PersonController { @Autowired PersonRepository personRepository; @RequestMapping("/get") public @ResponseBody Person getPerson() { Person person = personRepository.findOne(1L); return person; } } 而PersonRepository只是根据本指南编写的代码 public interface PersonRepository extends …
我正在从Angular的文档中查看此示例,$q但我认为这可能总体上适用于Promise。下面的示例从他们的文档中逐字复制,并包含注释: promiseB = promiseA.then(function(result) { return result + 1; }); // promiseB will be resolved immediately after promiseA is resolved and its value // will be the result of promiseA incremented by 1 我不清楚这是如何工作的。如果我可以调用.then()第一个的结果.then()并将它们链接起来(据我所知),那么它promiseB就是一个类型为Promise的对象Object。这不是一个Number。那么,它们的含义是“其值将是promiseA的结果加1”? 我应该以这种方式访问promiseB.value吗?成功回调如何返回承诺并返回“结果+ 1”?我想念一些东西。