springboot实战:(2)springboot

文章目录

  • 一、springboot
    • 1、springboot的构建
      • 1.1.官网构建工程(方法二:IDEA网络太差我们在官网配置)
    • 2 、一些相关配置

一、springboot

1、springboot的构建

1.1.官网构建工程(方法二:IDEA网络太差我们在官网配置)

进入SpringBoot官网:https://spring.io/projects/spring-boot
springboot实战:(2)springboot_第1张图片
springboot实战:(2)springboot_第2张图片
springboot实战:(2)springboot_第3张图片

2 、一些相关配置

  • pop.xml

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0modelVersion>
	<parent>
		<groupId>org.springframework.bootgroupId>
		<artifactId>spring-boot-starter-parentartifactId>
		<version>2.5.9version>
		<relativePath/> 
	parent>
	<groupId>com.qinggegroupId>
	<artifactId>springbootartifactId>
	<version>0.0.1-SNAPSHOTversion>
	<name>springbootname>
	<description>项目描述description>
	<properties>
		<java.version>1.8java.version>
	properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.bootgroupId>
			<artifactId>spring-boot-starter-webartifactId>
		dependency>
		<dependency>
			<groupId>org.mybatis.spring.bootgroupId>
			<artifactId>mybatis-spring-boot-starterartifactId>
			<version>2.2.2version>
		dependency>

		<dependency>
			<groupId>mysqlgroupId>
			<artifactId>mysql-connector-javaartifactId>
			<scope>runtimescope>
		dependency>
		<dependency>
			<groupId>org.projectlombokgroupId>
			<artifactId>lombokartifactId>
			<optional>trueoptional>
		dependency>

		
		<dependency>
			<groupId>com.baomidougroupId>
			<artifactId>mybatis-plus-boot-starterartifactId>
			<version>3.5.1version>
		dependency>
		
		<dependency>
			<groupId>com.baomidougroupId>
			<artifactId>mybatis-plus-generatorartifactId>
			<version>3.5.1version>
		dependency>
		<dependency>
			<groupId>org.apache.velocitygroupId>
			<artifactId>velocityartifactId>
			<version>1.7version>
		dependency>

		
		<dependency>
			<groupId>io.springfoxgroupId>
			<artifactId>springfox-boot-starterartifactId>
			<version>3.0.0version>
		dependency>

		
		<dependency>
			<groupId>cn.hutoolgroupId>
			<artifactId>hutool-allartifactId>
			<version>5.7.20version>
		dependency>
		<dependency>
			<groupId>org.apache.poigroupId>
			<artifactId>poi-ooxmlartifactId>
			<version>4.1.2version>
		dependency>

		
		<dependency>
			<groupId>com.auth0groupId>
			<artifactId>java-jwtartifactId>
			<version>3.10.3version>
		dependency>

		<dependency>
			<groupId>org.springframework.bootgroupId>
			<artifactId>spring-boot-starter-cacheartifactId>
		dependency>

		<dependency>
			<groupId>org.springframework.bootgroupId>
			<artifactId>spring-boot-starter-data-redisartifactId>
		dependency>
		<dependency>
			<groupId>org.springframework.bootgroupId>
			<artifactId>spring-boot-starter-testartifactId>
			<scope>testscope>
		dependency>
	dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.bootgroupId>
				<artifactId>spring-boot-maven-pluginartifactId>
				<configuration>
					<excludes>
						<exclude>
							<groupId>org.projectlombokgroupId>
							<artifactId>lombokartifactId>
						exclude>
					excludes>
				configuration>
			plugin>
		plugins>
	build>

project>

  • application.yml
#重新设置端口
server:
  ip: localhost
  port: 9090

spring:
  datasource:
    #MySQL配置
    driver-class-name: com.mysql.cj.jdbc.Driver
    #serverTimezone=GMT%2b8 东八区
    url: jdbc:mysql://localhost:3306/tests?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&serverTimezone=GMT%2b8
    username: root
    password: 123456
  redis:
    host: 127.0.0.1
    port: 6379
  servlet:
    multipart:
      max-file-size: 100MB
      max-request-size: 100MB

  main:
    #是根本原因,终究原因后面发现是SpringBoot和SpringCloud版本匹配问题导致的。
    allow-bean-definition-overriding: true

mybatis:
  mapper-locations: classpath:mapper/*.xml  #扫描所有mybatis的xml文件
#  configuration:
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

files:
  upload:
    path: D:/code/javacode/springboot/files/
#    path: /home/files/

你可能感兴趣的:(spring实战项目,spring,boot,java,intellij-idea)