인텔리제이 Properties 자동완성

IntelliJ Tip

Posted by Yun on 2018-08-05

위 그림처럼 유자가 추가한 properties 속성들도 자동 완성을 지원합니다.

또 Properties 속성이 코드에 바인딩 되는지 확인 할 수 있어 아주 유용합니다.

Properties

1
2
3
4
5
sample:
email: "yun@test.com"
name : "yun"
age: 27
auth: true
1
2
3
4
5
6
7
8
9
10
@Configuration
@ConfigurationProperties(prefix = "sample")
public class SampleProperties {
private String email;
private String name;
private int age;
private boolean auth;

// getter, setter
}

Properties 속성값과 바인딩 될 객체입니다.

Plugin 추가

대부분 이미 설치가 되어있을 겁니다.

의존성 추가

maven

1
2
3
4
5
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>

gradle

1
2
3
dependencies {
optional "org.springframework.boot:spring-boot-configuration-processor"
}

Intellij 설정

Settings > Build, Execution & Deployment > Compiler > Annotation Processors 에서 Enable annotation processing를 체크