标签:depend localhost data lse doc username 使用 nbsp mapping
一:新建Project,Idea是一款功能很强大的软件,有专门的生成springboot的插件
有时候会遇到timeout连接超时,将Defult默认的路径改为自定义:http://start.spring.io点击next
next
finish,等待idea自动构建架构
测试:
首先在applicationproperties文件配置
spring.datasource.url = jdbc:mysql://localhost:3306/test spring.datasource.username = root spring.datasource.password = 123456 spring.datasource.driverClassName = com.mysql.jdbc.Driver #页面热加载 spring.thymeleaf.cache = false #端口 server.port=8888
其次在静态文件夹static下创建test.css文件
在templates下创建HTML文件-hello.html
接下来写controller
package com.example.demo.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class indexController { @RequestMapping("index") public String index(){ return "hello"; } }
启动程序,有两种方法
启动成功:
https://blog.csdn.net/weixin_39274753/article/details/79606810(Mybatis入门)
使用mybatis xml方式进行编写配置
1.jar包支持
<!--mybatis核心包--> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.3.0</version> </dependency> <!--MySQL的JDBC驱动包--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.29</version> </dependency> <!--junit单元测试包--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency>
2.xml配置
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <environments default="development"> <environment id="development"> <transactionManager type="JDBC"/> <dataSource type="POOLED"> <property name="driver" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/mybatis"/> <property name="username" value="root"/> <property name="password" value="123"/> </dataSource> </environment> </environments> <mappers> <mapper resource="mapper/Person.xml"/> </mappers> </configuration>
https://www.cnblogs.com/-xuzhankun/p/6627424.html(参考包含springboot+mybatis xml形式的搭建)
Idea上搭建Springboot+mybatis+shiro
标签:depend localhost data lse doc username 使用 nbsp mapping
原文地址:https://www.cnblogs.com/fjlcoding/p/9473576.html