zoukankan      html  css  js  c++  java
  • springboot根据注解创建全文索引(springboot全文索引注解)

    使用方法:
     1.拉取代码到本地工作空间  
       git clone https://gitee.com/light-zhang/springboot-fulltext.git 
     2.项目中引入依赖  
     <dependency>
        <groupId>skdapp.cn</groupId>
        <artifactId>springboot.fulltext</artifactId>
        <version>0.0.1</version> 
      </dependency>     
    3.在项目中使用  
    //启动类注入(scanPackages你的om扫描路径)
    @SpringbootFulltext(scanPackages = { "skdapp.cn.xxx.entity" })
    @SpringBootApplication(scanBasePackages = { "skdapp.cn.xxx.xxx" })
    public class Application {
        public static void main(String[] args) {
            SpringApplication.run(Application.class, args);
        }
    } 
    
    4.实体类使用 
    @Entity
    @Table(name = "demo")
    public class Demo implements Serializable {
        @Id
        @GeneratedValue(generator = "uuid")
        @GenericGenerator(name = "uuid", strategy = "uuid")
        @Column(name = "pk_id", nullable = false, unique = true, length = 32, columnDefinition = "varchar(32) COMMENT '主键ID,生成32位随机字符串' ")
        private String pkId;
    
        @MysqlFulltext(columnName = "content")
        @Column(name = "content", columnDefinition = "text COMMENT '内容' ")
        private String content;
    } 
    
    启动项目时,就可以根据Fulltext注解的配置自动扫描创建全文索引了 
    @MysqlFulltext默认生成全文索引策略table名称_column列名_idx,
        如果@MysqlFulltext使用了属性indexesName则按照indexesName的名称为全文索引命名
  • 相关阅读:
    selenium产生的垃圾文件清理
    英语学习词根法
    ecommerce学习
    tfs2012安装
    转载文件,英语学习
    Mishka and Divisors CodeForces
    Codeforces Round #364 (Div. 1) (差一个后缀自动机)
    莫比乌斯反演练习
    bzoj 1267 Kth Number I (点分治,堆)
    程序员的绘图利器 — Gnuplot
  • 原文地址:https://www.cnblogs.com/light-zhang/p/13647262.html
Copyright © 2011-2022 走看看