본문 바로가기

카테고리 없음

intellij community 에서 springBoot 개발

더 편하게 인텔리 j 에서 스프링 부트를 개발하고 싶으면 인텔리 j ultimate 판을 사기를 권한다.

 

1. build. gradle 의 설정

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
buildscript{
    ext{
        springBootVersion ='2.1.7.RELEASE'
    }
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}
 
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
 
group 'com.example.web'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
 
repositories {
    mavenCentral()
    jcenter()
}
 
dependencies {
    testCompile('org.springframework.boot:spring-boot-starter-web')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}
 
test {
    useJUnitPlatform()
}
cs

 

2. lombok plugin 설치

   1. settings>plugins 에서 lombok plugin 검색후 install

   2.  settings > Annotation process 의 enable annotation processing 체크

 

3.Application.java 생성

위치는 모듈의 패키지 디렉토리 밑에 있어야 한다.

projectModule > Application.java

1
2
3
4
5
6
7
8
9
10
11
12
13
package com.example.web.springboot;
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
 
@SpringBootApplication
public class Application {
    public static void main(String[] args{
        SpringApplication.run(Application.class,args);
    }
 
}
 
cs

 

 

5.h2드라이버 연동

localhost:포트번호/h2-console 로 들어가자

jdbc url 항목에 jdbc:h2:mem:testdb 그리고 test connection 후 connection