SpringBootApplication 초기설정

intelliJ

프로젝트 생성
  1. File > NewProject > Maven

  2. java 버전 확인 후 next

  3. Artifact Coordinates 에 GroupId (패키지이름), ArtifactId (프로젝트 이름 작성 후 Finish)

pom.xml 추가


<!-- Inherit defaults from Spring Boot -->
   <parent>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-parent</artifactId>
       <version>2.0.3.RELEASE</version>
   </parent>

   <!-- Add typical dependencies for a web application -->
   <dependencies>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-web</artifactId>
       </dependency>
   </dependencies>

   <!-- Package as an executable jar -->
   <build>
       <plugins>
           <plugin>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-maven-plugin</artifactId>
           </plugin>
       </plugins>
   </build>
SpringBootApplication 클래스 생성
  • src > main> java 에 패키지 생성 후 클래스 생성


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);
  }
}

+ Recent posts