IDEA 템플릿 공용 코드 빠른 생성

8864 단어 IntelliJIDEA
idea 템플릿 공공 코드 빠른 생성
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#set($name = ${NAME})
#if (${NAME} && $name.endsWith("Controller"))
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
#end
#if (${NAME} && $name.endsWith("Service"))
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
#end
#if (${NAME} && $name.endsWith("Dao"))
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
#end
#parse("File Header.java")
/**
* @author ${USER}
* @date ${YEAR}-${MONTH}-${DAY}
*/
#if (${NAME} && $name.endsWith("Controller"))
@RestController
@RequestMapping("/")
#end
#if (${NAME} && ($name.endsWith("Service") || $name.endsWith("Dao")))
@Service
#end
public class ${NAME} #if (${NAME} && $name.endsWith("Service"))#end {
 #if (${NAME} && $name.endsWith("Controller"))

 @RequestMapping(value = "/demo", method = RequestMethod.GET)
 public String demo() {

 return "Demo + ${NAME}";
 }
 #end
}

좋은 웹페이지 즐겨찾기