Spring在Service层注入 sping-data-jdbc等等 Spring-Data的Repository时候,不能直接用
@Autowired PersonRepository personRepository;
这种形式,应该这样写!!!:
Funk Java Funk Spring
@Service public class PersonService { private final PersonRepository personRepository; @Autowired public PersonService(PersonRepository personRepository) { this.personRepository = personRepository; } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)