Eclipse's construction of spring-boot, spring-boot-mybatis

1. Preparations

1.1. If there is no sts (spring tool suite) plugin, you need to download it.

1.1.1. If you download eclipse, you must pay attention to the version, because eclipse will download the latest version directly. If the ts version does not correspond to eclipse, the springboot project will not be created. help--> Eclipse Marketplace, then select Popular, select sts, and click install. (Note: Before downloading, maven's image file is adjusted to aliyun's).

After downloading, if the version is wrong, you need to update: Help-->Install New Software-->work with Enter: http://dist.springsource.com/release/TOOLS/update/e4.6/

Note: e4.6 is the version of my eclipse, check the eclipse version: help-->About eclipse, then click the eclipse icon (generally the first one), find the Eclipses Platform under the Featrue name to view the version.

1.2. You can also choose to download here: https://spring.io/tools/sts/legacy, and install your own self-care girl.

2. Create a new sprint boot 

2.1.new-->other-->spring boot, select spring stater project, fill in as needed, after next, select web, select sql

, and then select the database, mine is mysql, I want to integrate mybatis, so I also point mybastis. (If you just click on the web, you will successfully create a new spring boot)

2.2. After the creation is completed, the jar package will be downloaded by itself. If the maven version is too low, the pom will report an org.codehaus.plexus.archiver.jar.Manifest.write(java.io.PrintWriter) error. The solution is:

  In help --> Install New Software > Work withthe input as follows,

https://otto.takari.io/content/sites/m2e.extras/m2eclipse-mavenarchiver/0.17.2/N/LATEST/,
然后回车,等待,安装完毕后重启即可。

配置数据库连接:

spring.datasource.url=jdbc:mysql://localhost:3306/数据库名字
spring.datasource.username=pass
spring.datasource.password=密码
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

#Configure the mapper mapping file, under the mapper file under resource
mybatis.mapper-locations= classpath:mapper/*.xml



 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325210456&siteId=291194637