spring boot中mybatis使用注解进行模糊查询@Select("select * from dept where dname like CONCAT('%',#{dname},'%') ")public List<Dept> getDeptByLikeDname(@Param(value = "dname") String dname); …
Spring Boot常用注解总结 @RestController和@RequestMapping注解 @RestController注解,它继承自@Controller注解.4.0之前的版本,Spring MVC的组件都使用@Controller来标识当前类是一个控制器servlet.使用这个特性,我们可以开发REST服务的时候不需要使用@Controller而专门的@RestController. 当你实现一个RESTful web services的时候,response将一直通过resp…
Mybatis注解开发模糊查询 一般在使用mybatis时都是采用xml文件保存sql语句 这篇文章讲一下在使用mybatis的注解开发时,如何进行模糊查询 模糊查询语句写法(在@Select注解中): where field like CONCAT('%',#{keyWord},'%') 下面是一些错误写法: where title like #{keyword} 这样写不会报错,但无法做到模糊查询. where title like '%#{keyword}%' 这样写会报错…
Spring Boot 核心注解讲解 Spring Boot 最大的特点是无需 XML 配置文件,能自动扫描包路径装载并注入对象,并能做到根据 classpath 下的 jar 包自动配置. 所以 Spring Boot 最核心的 3 个注解就是: 1.@Configuration org.springframework.context.annotation.Configuration 这是 Spring 3.0 添加的一个注解,用来代替 applicationContext.xml 配置文件,…