kotlin web开发教程【一】从零搭建kotlin与spring boot开发环境
IDEA中文输入法的智能提示框不会跟随光标的问题
我用的开发工具是IDEA



使用spring boot官网的工具构建工程
- Web:包含所有spring mvc,tomcat需要的东西(spring boot是基于spring mvc的);
- DevTools:srping boot的开发工具,比如“热部署”等
- JPA:ORM框架
- MySQL:mysql的JDBC驱动
- Actuator:应用配置及应用监控工具
- Freemarker:页面模版引擎,有点类似ASP.NET MVC的razor

Cannot determine embedded database driver class for database type NONE
gradle配置
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-freemarker')
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.jetbrains.kotlin:kotlin-stdlib-jre8")
compile("org.jetbrains.kotlin:kotlin-reflect")
runtime('org.springframework.boot:spring-boot-devtools')
runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
- spring-boot-starter-actuator:SpringBoot的健康检监控组件的启动器
- spring-boot-starter-data-jpa:JPA的启动器
- spring-boot-starter-freemarker:freemarker的启动器
- kotlin-stdlib-jre8:kotlin基于jre8的标准库
- kotlin-reflect:kotlin反射库
- spring-boot-devtools:spring-boot开发者工具,比如“热部署”等
- mysql-connector-java:java的mysql链接工具
- spring-boot-starter-test:spring-boot测试工具启动器
application.properties配置
#data source
spring.datasource.url=jdbc:mysql://******.mysql.rds.aliyuncs.com:3306/yourDBName?characterEncoding=utf8&characterSetResults=utf8
spring.datasource.username=******
spring.datasource.password=******
spring.jpa.database=mysql
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
server.port=8000
spring.datasource.tomcat.test-while-idle=true
spring.datasource.tomcat.validation-query= Select 1
2017-12-23 12:24:43.220 INFO 460 --- [ restartedMain] com.ysl.jna.jna.JnaApplicationKt : Started JnaApplicationKt in 7.447 seconds (JVM running for 8.208)
2017-12-23 13:30:39.642 INFO 6788 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
编写controller
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sun Dec 24 17:14:43 CST 2017
There was an unexpected error (type=Not Found, status=404).
No message available
package com.ysl.jna.controller
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
@RestController
class HelloController{
@GetMapping(value = *arrayOf("/hello","/"))
fun hello():Any{
return "hello"
}
}
hello
kotlin web开发教程【一】从零搭建kotlin与spring boot开发环境的更多相关文章
- Spring Boot从入门到精通(一)搭建第一个Spring Boot程序
Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置.通过 ...
- 新入手服务器不会玩?抢占式实例服务器教程,从零搭建tomcat超简流程
新入手服务器不会玩?抢占式实例服务器教程,从零搭建tomcat超简流程 相信很多新人入手Linux服务器后,一脸无奈,这黑框框究竟能干啥?忽觉巨亏血亏不是? 这里面门道可不是你想象中的那么点,简则服务 ...
- spring boot 开发环境搭建(Eclipse)
Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...
- 使用Spring Boot开发Web项目(二)之添加HTTPS支持
上篇博客使用Spring Boot开发Web项目我们简单介绍了使用如何使用Spring Boot创建一个使用了Thymeleaf模板引擎的Web项目,当然这还远远不够.今天我们再来看看如何给我们的We ...
- Spring Boot——开发新一代Spring应用
Spring官方网站本身使用Spring框架开发,随着功能以及业务逻辑的日益复杂,应用伴随着大量的XML配置文件以及复杂的Bean依赖关系.随着Spring 3.0的发布,Spring IO团队逐渐开 ...
- SpringBoot零XML配置的Spring Boot Application
Spring Boot 提供了一种统一的方式来管理应用的配置,允许开发人员使用属性properties文件.YAML 文件.环境变量和命令行参数来定义优先级不同的配置值.零XML配置的Spring B ...
- 天天玩微信,Spring Boot 开发私有即时通信系统了解一下
1/ 概述 利用Spring Boot作为基础框架,Spring Security作为安全框架,WebSocket作为通信框架,实现点对点聊天和群聊天. 2/ 所需依赖 Spring Boot 版本 ...
- Spring Boot 开发集成 WebSocket,实现私有即时通信系统
1/ 概述 利用Spring Boot作为基础框架,Spring Security作为安全框架,WebSocket作为通信框架,实现点对点聊天和群聊天. 2/ 所需依赖 Spring Boot 版本 ...
- Spring Boot开发RESTful接⼝服务及单元测试
Spring Boot开发RESTful接⼝服务及单元测试 常用注解解释说明: @Controller :修饰class,⽤来创建处理http请求的对象 @RestController :Spring ...
- 使用Spring boot开发RestFul 风格项目PUT/DELETE方法不起作用
在使用Spring boot 开发restful 风格的项目,put.delete方法不起作用,解决办法. 实体类Student @Data public class Student { privat ...
随机推荐
- 外键删除(T-SQL Drop Foreign Key)
列出某张表相关的 FK Name select distinct name from sys.objects where object_id in ( select fk.constraint_o ...
- Lucene全文检索引擎
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- 非对称加密技术- RSA算法数学原理分析
非对称加密技术,在现在网络中,有非常广泛应用.加密技术更是数字货币的基础. 所谓非对称,就是指该算法需要一对密钥,使用其中一个(公钥)加密,则需要用另一个(私钥)才能解密. 但是对于其原理大部分同学应 ...
- 分享一篇vue项目规范
最近 Vue 用的比较多,而且因为公司里有实习生,当几个人写一个项目的时候,会出现很多问题,最麻烦的就是规范不统一,之前我有一篇文章是说, vue 是比较有规范的一种框架了,但是也会出现很多问题,所以 ...
- 阿里云VPS搭建Hexo博客
最近买了一个阿里云服务器,准备写自己的网站,和将自己的作品放在上面:开始的时候,感觉就一个服务器应该很简单,但是从申请域名到备案,再到服务器搭建,没想到一波三折:闲话不多说,只是记录我在搭建时,最简单 ...
- Grafana+Prometheus系统监控之SpringBoot
前言 前一段时间使用SpringBoot创建了一个webhook项目,由于近期项目中也使用了不少SpringBoot相关的项目,趁着周末,配置一下使用prometheus监控微服务Springboot ...
- 《java.util.concurrent 包源码阅读》19 PriorityBlockingQueue
前面讲ScheduledThreadPoolExecutor曾经重点讲到了DelayedWorkQueue,这里说的PriorityBlockingQueue其实是DelayedWorkQueue的简 ...
- ssh免密验证,shell批量设置
ssh免密验证,shell批量设置 #ssh免密验证,shell自动设置 echo '#!/bin/sh . /etc/init.d/functions [[ -f /usr/bin/expect ] ...
- js实现关键词高亮显示 正则匹配
html 和ajax 部分就不写了,只需将需要匹配的文字传进去就可以了 比如匹配后台传回的字符串data.content中的关键词:直接调用: data.content = highLightKeyw ...
- 解决tomcat部署包错误
Context namespace element 'annotation-config' and its parser class [org.springframework.context.anno ...