记录一下Springboot遇到的三个问题 1、@Autowired 一次只能载入一个bean吗? 2、自定义的类型没办法接受,可是Object却可以。 3、public interface ArticleDao extends JpaRepository<Article, Integer> { @Transactional @Modifying @Query(value = "insert into article(id,title,date,author,text,textleng) values (?1,?2, ?3, ?4, ?5, ?6)", nativeQuery = true) int saveActicle(@Param("id") int id,@Param("title") String title,@Param("date") String date,@Param("author") String author,@Param("text") String text,@Param("textleng") String textlengt);
// 写在这里没办法直接注入实体类ArticleList @Query(value = "select * from articleList where title=?1", nativeQuery = true) ArticleList findbyArticleTitle(@Param("title") String name); }
4、Map<String, ArticleList> findbyArticleTitle(@Param("title") String name); 如果我这样写我取值的时候Map<String, ArticleList> articleList articleList.get('id')的时候拿不出来,会报类型转换失败的错误。但是这样却可以Map<String, Object>