<file_sep>package com.sdcuike.gradlelearning.controller;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author sdcuike
 * @date 2018/4/23
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    @PostMapping("/test")
    public DemoResponseDto test(@RequestBody DemoRequestDto demoRequestDto) {
        return new DemoResponseDto(0, "");
    }


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DemoRequestDto {

        private String name;
        private Integer age;

    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DemoResponseDto {
        private Integer code;
        private String msg;

    }
}
<file_sep>buildscript {
    ext {
        springBootVersion = '2.0.1.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath 'com.webcohesion.enunciate:enunciate-lombok:2.10.1'

    }
}

plugins {
    id 'io.franzbecker.gradle-lombok' version '1.13'
    id "com.webcohesion.enunciate" version "2.10.1"
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.sdcuike'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compileOnly('org.projectlombok:lombok')


    testCompile('org.springframework.boot:spring-boot-starter-test')
}




tasks.enunciate {
    File enunciateDistDir = file("src/main/resources/static/docs/api")
    doFirst {
        project.delete("build/enunciate")
        enunciateDistDir.deleteDir()
        enunciateDistDir.mkdirs()
    }
    export("docs", enunciateDistDir)
}


assemble {
    doFirst {
        enunciate.execute()
    }
}<file_sep># gradle-learning



## enunciate文档自动生成（集成lombok）
- [文档访问地址:本地启动](http://localhost:8080/docs/api/index.html)
- [上述文档可进入swagger 界面](http://localhost:8080/docs/api/ui/index.html)


## 
[https://github.com/sdcuike/gradle-learning/tree/enunciate文档自动生成-集成lombok](https://github.com/sdcuike/gradle-learning/tree/enunciate文档自动生成-集成lombok)<file_sep>rootProject.name = 'gradle-learning'
<file_sep>package com.sdcuike.gradlelearning;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author sdcuike
 * @date 2018/4/23
 */
@SpringBootApplication
public class GradleLearningApplication {

    public static void main(String[] args) {
        SpringApplication.run(GradleLearningApplication.class, args);
    }
}
