zl程序教程

您现在的位置是:首页 >  后端

当前栏目

springboot 学习

2023-09-11 14:21:22 时间

参考:http://www.cnblogs.com/sam-uncle/p/8796212.html

 

spring boot 系列之一:spring boot 入门

注意:main启动类和controller包,必须同级

 

 

spring boot 系列之二:spring boot 如何修改默认端口号和contextpath

配置了port和context-path

我的代码如下

@RestController
@RequestMapping("hello")
public class HelloController {
    @RequestMapping(value = "say",method = RequestMethod.GET)
    public String sayHello() {
        return "hello ,spring boot";
    }
}

我的访问路径:http://localhost:8090/test/hello/say

 

spring boot 系列之三:spring boot 整合JdbcTemplate

同样的问题,所有包必须和main类同级,

然后在application.properties配置一下datasource就可以了。

 

spring boot 系列之四:spring boot 整合JPA

注意:Dao或者说Repository 只要创建 Interface就可以了。因为JpaRepository 或者 CrudRepository

已经实现了。

如果要添加额外的,那也是在Interface中添加,然后通过sql语句实现。

 

spring boot 系列之五:spring boot 通过devtools进行热部署

热部署,这一块我没试,以后用到再说。