티스토리 뷰

프로젝트 생성

new-project-Maven Project를 생성한다.

groupId와 artifactId를 적고 프로젝트 생성을 하면 이미지처럼 나오게 된다.

(그냥 아무 프로젝트 만들어서 우클릭-configure-convert to maven project로 해도 된다)


Spring boot 라이브러리 추가

pom.xml을 열어서 dependencies와 동일 레벨로 parent를 추가한다.

  
    org.springframework.boot
    spring-boot-starter-parent
    1.4.0.RELEASE
   

dependencies 하위 항목으로 다음을 추가한다.

        
	        org.springframework.boot
	        spring-boot-starter
        


메인 소스 작성

Application 클래스를 생성하여 다음과 같이 작성 해준다.

package donnert.spring.boot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String[] args) throws Exception {
        SpringApplication.run(Application.class, args);
    }
}

테스트

실행을 해보면 다음과 같이 스프링이 돌아가는걸 볼 수 있다.

아무것도 없는 기본 예제지만 스프링 기반의 환경(?)이 만들어 졌다.


다음글로 계속..

2016/09/07 - [개발/JAVA] - 스프링 부트(Spring boot)로 scheduling 개발하기



  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::        (v1.3.5.RELEASE)


2016-09-07 11:06:27.631  INFO 5216 --- [           main] net.donnert.spring.boot.Application      : Starting Application on ezen-PC with PID 5216 (D:\Java\workspace\Ezens\paynow_simulator\spring.boot\target\classes started by donne in D:\Java\workspace\Ezens\paynow_simulator\spring.boot)

2016-09-07 11:06:27.635  INFO 5216 --- [           main] net.donnert.spring.boot.Application      : No active profile set, falling back to default profiles: default

2016-09-07 11:06:27.718  INFO 5216 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@6765f738: startup date [Wed Sep 07 11:06:27 KST 2016]; root of context hierarchy

2016-09-07 11:06:28.888  INFO 5216 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup

2016-09-07 11:06:28.907  INFO 5216 --- [           main] net.donnert.spring.boot.Application      : Started Application in 1.674 seconds (JVM running for 2.058)

2016-09-07 11:06:28.908  INFO 5216 --- [       Thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@6765f738: startup date [Wed Sep 07 11:06:27 KST 2016]; root of context hierarchy

2016-09-07 11:06:28.910  INFO 5216 --- [       Thread-1] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown



댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
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
글 보관함