1.Spring Boot configurations
application.ymlspring: profiles: active: dev mvc: favicon: enabled: false datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/wit_neptune?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true username: root password: 123456 jpa: hibernate: ddl-auto: update show-sql: true2.Spring Boot Application
WitApp.java/* * Copyright 2016-2017 WitPool.org All Rights Reserved. * * You may not use this file except in compliance with the License. * A copy of the License is located at * http:// * @Date : 2017-11-15 PM 2:50:27 * @Version : 1.0 */public interface WitRepository extends JpaRepository<WitUser, Integer>{ public List<WitUser> findByUserName(String userName);}7.代码下载、编译、打包
代码下载请访问 GitHub上的 witpool/Wit-Neptune
导入工程文件、编译、打包步骤如下:
Eclipse 导入maven工程
导入Maven工程
Maven打包
8.启动和UT步骤
启动应用:java -jar wit-rest-1.0.jar
UT步骤:
(1). 下载WisdomTool REST Client
(2). 双击 JAR包 restclient-1.1.jar 启动工具
导入测试用例文件:
关于WisdomTool REST Client更多的使用帮助,请参考GitHub wisdomtool/rest-client
总结
以上所述是小编给大家介绍的Spring Boot 实现Restful webservice服务端示例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!