Lucene结合SpringBoot框架返回jsp页面Demo

最近在研究Lucene和SpringBoot框架,从网上搜索啦好多相关知识就想把这两个内容结合起来做一个Demo,一来进一步熟悉这两个内容记下来以后好来回顾,二来与他人进行分享交流。废话不多说,接下来就开始。

1、先我们先来搭建SpringBoot框架:

新建一个Maven工程这个就不做太多描述打开pom.xml添加依赖

引入SpringBoot依赖

这里让SpringBoot 的parent作为项目的parent

  
      org.springframework.boot
      spring-boot-starter-web
      
 
    org.springframework.boot
    spring-boot-starter-parent
    1.4.0.RELEASE
    
                           

添加对jsp的支持

  
	   javax.servlet
	   jstl
	  
   
    org.apache.tomcat.embed
    tomcat-embed-jasper
    provided
                    

还要在src/main/resources下建立application.properties配置文件配置view层前后缀

spring.mvc.view.prefix: /
spring.mvc.view.suffix: .jsp


添加对Lucene的依赖


		org.apache.lucene
		lucene-core
		5.3.1
	
	
	
	org.apache.lucene
		lucene-queryparser
		5.3.1
	
	
	
		org.apache.lucene
		lucene-analyzers-common
		5.3.1
	
	
	
    org.apache.lucene
    lucene-highlighter
    5.3.1

/
	
    org.apache.lucene
    lucene-analyzers-smartcn
    5.3.1

这样pom文件的配置就大概完成啦 附一下整体的pom配置

 

  4.0.0


  SpringBootTest
  SpringBootTest
  0.0.1-SNAPSHOT


  SpringBootTest
  SpringBootTest


  
    org.springframework.boot
    spring-boot-starter-parent
    1.4.0.RELEASE
    
  


  
    &

你可能感兴趣的:(SpringBoot,java,Lucene)