springboot开发使用
Eclipse开发使用springboot
在http://start.spring.io/官网上下载springboot架构,导入eclipse工程,加上spring-boot-starter-web依赖包,开发使用
Idea开发使用
在相关项目结构下载,建立工程,其中可能会因为网络问题导致无法运行,需重新导入依赖包。
配置热部署
添加spring-boot-devtools依赖,并配置idea中有关热部署的配置。
springboot定时任务
应用场景,到需要隔一段时间发送一次请求时,则可以用到springboot定时任务,打开启动类中注解@enablescheduling,创建定时任务类,方法上使用scheduled(fixedRate=6000),fixeddelay/cron实现定时。
Properties和yml的区别。Yml配置层次感更强方便查看。
Springboot集成mybatis时遇到的问题
mapper注入问题,其一出现原因mybatis-spring-boot-starter包缺失,或不完全。其二注解启动类注解@MapperScan(“com.example.demofirst.dao”)。mapper.xml无法被springboot扫描到 ,运行时打包在resources下而不再java下,需在pom中配置打包位置
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>com/example/demofirst/dao/mapper/*.xml</include>
</includes>
</resource>
</resources>