Springboot+MybatisPlus基础搭建

Springboot+MybatisPlus基础搭建

搭建工具及环境:IDEA+Jdk1.8+maven

结合代码生成器篇使用

https://blog.csdn.net/YangChingyuk/article/details/122486935?spm=1001.2014.3001.5502

创建工程

New Project  
	--> Maven
		--> Create from archetype
			--> maven-archetype-quickstart

ps:如果生成的项目工程没有resources目录

main文件下生成resources目录
	New Directory 
		选择 Mark Directory as --> Sources Root

核心pom依赖


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



	......
	3.4.1
	2.3
	3.3.2
	1.2.12
	1.16.18
	12.2.0.1
	1.2.67



	......
	
	
	
		org.springframework.boot
		spring-boot-devtools
	

	
		org.springframework.boot
		spring-boot-test
	

	
	
		org.springframework.boot
		spring-boot-starter-web
	
	
	
	
		com.baomidou
		mybatis-plus-boot-starter
		${mybatis-plus.version}
	
	
		org.apache.velocity
		velocity-engine-core
		${velocity.version}
	
	
		com.baomidou
		mybatis-plus-generate
		${mybatis-plus-generate.version}
	

	
		log4j
		log4j
		${log4j.version}
	
	
	
		org.projectlombok
		lombok
		${lombok.version}
	

	
	
		com.oracle
		ojdbc8
		${ojdbc8.version}
	

	
		com.alibaba
		fastjson
		${fastjson.version}
	




	springboot-app
	
		
			org.apache.maven.plugins
			maven-compiler-plugin
			3.8.0
			
				8
				8
			
		
		
			org.springframework.boot
			spring-boot-maven-plugin
			2.1.3.RELEASE
			
				
					
						repackage
						build-info
					
				
			
		
	


application-dev.yml配置文件,放置resources下

server:
	port: 8080

spring:
	application:
		name: springboot-app
	datasource:
		type: com.zaxxer.hikari.HikariDataSource
		driver-class-name: oracle.jdbc.OracleDriver
		url: jdbc:oracle:thin:@host:port:DBName
		username: xxx
		password: xxx

mybatis-plus:
	mapper-locations: classpath:/mapper/xml/*.xml
	configuration:
		log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
		

mapper.xml 放置resources下!

启动类增加注解

@MapperScan({"com.yck.springboot.mapper"})
@SpringBootApplication(scanBasePackages = "com.yck")
public class SpringbootDemoApplication {

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

配置划分
application.yml

spring:
	profiles:
		active: dev

TODO

你可能感兴趣的:(java,springboot,mybatisplus,java,springboot)