SHARE
TWEET

Untitled

a guest Jul 12th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. buildscript {
  2.     ext {
  3.         kotlinVersion = '1.2.51'
  4.         springBootVersion = '2.0.4.RELEASE'
  5.     }
  6.     repositories {
  7.         mavenCentral()
  8.     }
  9.     dependencies {
  10.         classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
  11.         classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
  12.         classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
  13.         classpath("org.jetbrains.kotlin:kotlin-noarg:${kotlinVersion}")
  14.  
  15.         // add docker dependency
  16.         classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE")
  17.         // using Gradle you need to add a new docker plugin like this:
  18.         classpath('se.transmode.gradle:gradle-docker:1.2')
  19.     }
  20. }
  21. apply plugin: 'kotlin-jpa'
  22. apply plugin: 'kotlin'
  23. apply plugin: 'kotlin-spring'
  24. apply plugin: 'eclipse-wtp'
  25. apply plugin: 'org.springframework.boot'
  26. apply plugin: 'io.spring.dependency-management'
  27. apply plugin: 'war'
  28. // apply this docker plugin
  29. apply plugin: 'docker'
  30.  
  31. group = 'com.example'
  32. version = '0.0.1-SNAPSHOT'
  33. sourceCompatibility = 1.8
  34. compileKotlin {
  35.     kotlinOptions {
  36.         freeCompilerArgs = ["-Xjsr305=strict"]
  37.         jvmTarget = "1.8"
  38.     }
  39. }
  40. compileTestKotlin {
  41.     kotlinOptions {
  42.         freeCompilerArgs = ["-Xjsr305=strict"]
  43.         jvmTarget = "1.8"
  44.     }
  45. }
  46.  
  47. repositories {
  48.     mavenCentral()
  49. }
  50.  
  51. configurations {
  52.     providedRuntime
  53. }
  54.  
  55. dependencies {
  56.     compile 'mysql:mysql-connector-java'
  57.     compile('org.springframework.boot:spring-boot-starter-data-rest')
  58.     implementation("org.springframework.boot:spring-boot-starter-data-jpa")
  59.  
  60.     compile('org.springframework.boot:spring-boot-starter-web')
  61.     compile('com.fasterxml.jackson.module:jackson-module-kotlin')
  62.     compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
  63.     compile("org.jetbrains.kotlin:kotlin-reflect")
  64.     providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
  65.     testCompile('org.springframework.boot:spring-boot-starter-test')
  66. }
  67.  
  68. // write this docker build task, this will run just after "./gradlew build" command
  69. task buildDocker(type: Docker, dependsOn: build) {
  70.     push = true
  71.     applicationName = bootJar.baseName
  72.     dockerfile = file('Dockerfile')
  73.     doFirst {
  74.         copy {
  75.             from jar
  76.             into stageDir
  77.         }
  78.     }
  79. }
  80.      
  81. package com.model
  82.  
  83. import javax.persistence.*
  84. import javax.validation.constraints.NotBlank
  85. import javax.validation.constraints.NotNull
  86.  
  87. @Entity
  88. data class Admin(@Id
  89.                  @GeneratedValue(strategy = GenerationType.IDENTITY)
  90.                  @get: NotNull
  91.                  var userID: Long,
  92.                  @get: NotBlank
  93.                  var username: String,
  94.                  @get: NotBlank
  95.                  var password: String,
  96.                  @get: NotBlank
  97.                  var registerData: String,
  98.                  @get: NotBlank
  99.                  var email: String)
  100.      
  101. package com.repository
  102. import com.model.Admin
  103. import org.springframework.data.jpa.repository.JpaRepository
  104. import org.springframework.stereotype.Repository
  105.  
  106. @Repository
  107. interface AdminRepository : JpaRepository<Admin?, Long>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top