21 October 2015

Intellij

  • resource 파일들은 수정되지 않으면 target으로 복사되지 않는다.
    • make 하기 전에 maven:clean 하도록 하면 해결된다.

jsp

  • spring boot run configuration은 jsp를 사용할 때, 제대로 작동하지 않는다.
    • jar packaging을 통해서 embded tomcat으로 실행할 시 jsp가 안되는 버그가 있다.
    • maven의 spring-boot 플러그인의 run goal 을 사용해서 실행하거나
    • war packaging 을 하고 톰캣 모듈로 실행시킨다.

Velocity

  • 처음에 설정할 때 template에 있는 velocity를 선택한다.
  • maven 이든 gradle 이든 dependency 설정이 되면 자동으로 설정이 된다.
  • application.properties에서 문자셋 설정
spring.velocity.charset=UTF-8
spring.velocity.properties.input.encoding=UTF-8
spring.velocity.output.encoding=UTF-8
  • resources/templates 디렉토리 안에 *.vm 파일로 저장한다.
  • error.vm 에러 났을 때 나오는 템플릿
  • spring-boot는 기본적으로 web.xml이 없으니까 xml 없이 하려면 컨트롤러를 하나 만드는게 편할 수도 있다.
@Controller
@RequestMapping("/")
public class MainController {

    @RequestMapping("/")
    public String index(){
        return "index";
    }

    @RequestMapping("/{template}.vm")
    public String index(@PathVariable("template") String template){
        return template;
    }
}

Datasource

  • application.properties
spring.datasource.url=jdbc:mysql://localhost/test
spring.datasource.username=test
spring.datasource.password=test
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

Gradle

프로젝트 시작할 때 인텔리제이가 그래들을 인식할려고 하는 알림 메시지가 뜬다. 이때를 놓치면, 프로젝트를 다시 임포트하면서 그래들 프로젝트로 임포트 하면 된다.

Lombok

getter/setter 자동생성해주는 등의 기능이 있는 플러그인

  1. Lombok 사용시 preferences-> Compiler -> Annotation Processors에서 enable annotation processing 을 활성화 시켜줘야 한다.
  2. 1번 조치를 한 후에는 Build -> rebuild project 를 해야 적용이 된다.


blog comments powered by Disqus
처음으로