springboot项目练习一 搭建springboot应用

版权声明: https://blog.csdn.net/Master_chaoAndQi/article/details/85802828

项目介绍:

           1 将下载完成的网易新闻的json数据进行解析,映射成solr索引文档对应的字段

           2  使用ligurUi进行前端页面展示

           3 将抓取到的页面进行静态化生成html文档

项目环境搭建:

1 pom文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.gc.springboot</groupId>
	<artifactId>springboot_solr</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>1.8</java.version>
	</properties>
	<!-- springboot 父依赖 -->
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.5.RELEASE</version>
	</parent>
	<dependencies>
		<!-- web 依赖 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<!-- solr依赖 -->
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-solr</artifactId>
		</dependency>
		<!-- 热部署 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	<!-- maven插件 -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>

2 新建application.properties文件

server.port=8090 // 服务端口号
spring.data.solr.host=http://192.168.34.3:8080/solr  // solr地址
spring.data.solr.repositories.enabled=true 
spring.data.solr.collection=collection1  // solr存储位置

3 启动类app.calss

package com.gc.app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class App {
public static void main(String[] args) {
	SpringApplication.run(App.class, args);
}
}

 4 启动项目

http://localhost:8090/index.html

项目环境搭建完成,下面开始测试搭建solr服务,配置solr字段信息

扫描二维码关注公众号,回复: 4886819 查看本文章

猜你喜欢

转载自blog.csdn.net/Master_chaoAndQi/article/details/85802828