spring mybatics

spring boot     web、mysql、mybatics、jps

https://github.com/forezp/SpringBootLearning

1、这个加完可以访问页面(没加数据库配置的情况下,有数据库还的配置下面的)

@RestController
public class UserController {
    @RequestMapping("/hello")
    public String index() {
        return "Hello World";
    }
}

2、带mytatics的不报错了

application.properties配置文件中引入数据源:

1
2
3
4
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

3、访问数据库

猜你喜欢

转载自www.cnblogs.com/cnchengv/p/9883041.html