若没有注入。则报空指针异常。
也会报:Failed to configure a DataSource: 'url' attribute is not specified and no em.....
也会报: Servlet.service() for servlet [dispatcherServlet] in context with path []
解决方法: 1、业务层实现类中:xxxServiceImpl 中的 Repository 加入: @Resource注解。 @Resource private XxxxRepository xxxRepository; 2、在:Repository层:加入:@Resource(name="xxxxJdbcTemplate")。 @Repository public class XxxxxRepository { @Resource(name="xxxxJdbcTemplate") protected JdbcTemplate xxxxJdbcTemplate;