0
点赞
收藏
分享

微信扫一扫

spring boot:create 2.0+版本的新项目创建 map-getdef


spring boot 2.0+版本  的新项目创建

spring boot:create 2.0+版本的新项目创建  map-getdef_xml

 

然后:

spring boot:create 2.0+版本的新项目创建  map-getdef_maven_02

 

1.

spring boot:create 2.0+版本的新项目创建  map-getdef_maven_03

先选spring boot-web

2,。

spring boot:create 2.0+版本的新项目创建  map-getdef_spring_04

 

再选数据库相关的   

3.得到以下的pom.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<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.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.7.RELEASE</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.hc</groupId>
	<artifactId>god</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>god</name>
	<description>Demo project for Spring Boot</description>

	<properties>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>

4.基本配置

spring:
  datasource:
    username: root
    password: root
    url: jdbc:mysql://127.0.0.1:3306/cn?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false
    driver-class-name: com.mysql.cj.jdbc.Driver

server:
  port: 80
  servlet:
    context-path: /

---
spring:
  application:
    name: cloud

mybatis-plus:
  mapper-locations: classpath:/data/*Mapper.xml
  typeAliasesPackage: com.hc.model
  global-config:
    id-type: 0
    field-strategy: 1
    db-column-underline: true
    refresh-mapper: true
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: true

logging:
  level:
    com.hc.mapper: debug

5.

spring boot:create 2.0+版本的新项目创建  map-getdef_xml_05

 

 

参照

 

Integer.parseInt(params.getOrDefault(PAGE, 1).toString())

取map  若无,则为1

举报

相关推荐

0 条评论