title: Spring boot isn't serializing kotlin class
body: <p>I'm trying to build a simple api with spring boot and kotlin. When I make a request to save a new user everything goes well, a new user is persisted, but response body is empty. I don't know why, I return the new user. Please help me to understand why Jackson isn't serializing my kotlin class.</p>
  
  <p>I can assure that the user returned is not null.</p>
  
  <p>Entity:</p>
  
  <pre><code>@Entity
  data class User(@Id
                  @GeneratedValue(strategy = GenerationType.IDENTITY)
                  private val id: Long = 0L,
                  private var createdAt: LocalDateTime = LocalDateTime.now(),
                  private var enabled: Boolean = false,
                  private val username: String = "",
                  private val password: String = "",
                  private val name: String = "") {
  
      @PrePersist
      private fun onCreate() {
          this.enabled = true
          this.createdAt = LocalDateTime.now();
      }
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>@RestController
  @RequestMapping("users")
  class UserController {
  
      @Autowired
      private lateinit var userService: UserService
  
      @PostMapping
      fun save(@RequestBody user: User): User {
          return this.userService.save(user)
      }
  }
  </code></pre>
  
  <p>build.gradle:</p>
  
  <pre><code>buildscript {
      ext {
          kotlinVersion = '1.2.20'
          springBootVersion = '2.0.0.RC1'
      }
      repositories {
          mavenCentral()
          maven { url "https://repo.spring.io/snapshot" }
          maven { url "https://repo.spring.io/milestone" }
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
          classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
          classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
      }
  }
  
  apply plugin: 'kotlin'
  apply plugin: 'kotlin-spring'
  apply plugin: 'eclipse'
  apply plugin: 'org.springframework.boot'
  apply plugin: 'io.spring.dependency-management'
  
  group = 'br.com'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = 1.8
  compileKotlin {
      kotlinOptions {
          freeCompilerArgs = ["-Xjsr305=strict"]
          jvmTarget = "1.8"
      }
  }
  compileTestKotlin {
      kotlinOptions {
          freeCompilerArgs = ["-Xjsr305=strict"]
          jvmTarget = "1.8"
      }
  }
  
  repositories {
      mavenCentral()
      maven { url "https://repo.spring.io/snapshot" }
      maven { url "https://repo.spring.io/milestone" }
  }
  
  
  dependencies {
      compile('org.springframework.boot:spring-boot-starter-data-jpa')
      compile('org.springframework.boot:spring-boot-starter-web')
      compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
      compile("org.jetbrains.kotlin:kotlin-reflect")
      //JACKSON
      compile "com.fasterxml.jackson.core:jackson-annotations"
      compile "com.fasterxml.jackson.core:jackson-core"
      compile "com.fasterxml.jackson.core:jackson-databind"
      runtime "com.fasterxml.jackson.datatype:jackson-datatype-jdk8"
      runtime "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
      runtime "com.fasterxml.jackson.module:jackson-module-kotlin"
      runtime('mysql:mysql-connector-java')
      runtime('org.springframework.boot:spring-boot-devtools')
      testCompile('org.springframework.boot:spring-boot-starter-test')
  }
  </code></pre>
  
  <p>application.properties</p>
  
  <pre><code>#DATA SOURCE
  spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  spring.datasource.url=jdbc\:mysql\://localhost:3307/kotlin-library
  spring.datasource.username = root
  spring.datasource.password =
  
  #JPA
  spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
  spring.jpa.show-sql=true
  spring.jpa.hibernate.ddl-auto=update
  
  #SERVER
  server.servlet.context-path=/
  
  #JACKSON
  spring.jackson.serialization.indent-output=true
  spring.jackson.serialization.write-dates-as-timestamps=false
  spring.jackson.serialization.write-durations-as-timestamps=false
  </code></pre>