使用方法: 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的名稱為全文索引命名