Created
March 18, 2017 16:35
-
-
Save yusufsoysal/dcb6748e0fbcbece7311aa1b48371028 to your computer and use it in GitHub Desktop.
IntelliJ IDEA Java Class Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end | |
#parse("File Header.java") | |
#set($isClassService = $NAME.endsWith("Service")) | |
#set($isClassController = $NAME.endsWith("Controller")) | |
#if (${isClassController}) | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Controller; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
@Controller | |
@RequestMapping(value = "CHANGE_ME") | |
#elseif (${isClassService}) | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Service; | |
@Service | |
#end | |
public class ${NAME} { | |
#if (${NAME.endsWith("Service")}) | |
#set($lastIndex = $NAME.lastIndexOf("Service")) | |
#set($daoClass = $NAME.substring(0,$lastIndex) + "Dao") | |
@Autowired | |
private ${daoClass} dao; | |
#elseif (${NAME.endsWith("Controller")}) | |
#set($lastIndex = $NAME.lastIndexOf("Controller")) | |
#set($serviceClass = $NAME.substring(0,$lastIndex) + "Service") | |
@Autowired | |
private ${serviceClass} service; | |
#end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment