본문 바로가기
개발/Spring Boot

1.Spring Boot 환경 셋팅

by 카리3 2021. 2. 6.

1. Eclipse Download

2. Eclipse 환경설정

Preference > Maven > User Settings

create Maven Project

3. Spring Boot Web 설정 확인

0) pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>	
  <groupId>com.kangong</groupId>
  <artifactId>boot-kangong</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>boot-kangong</name>
  <description>Kangong Project</description>
    
  <parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.4.2</version>
		<relativePath/> <!-- lookup parent from repository -->
  </parent>	
  
	<properties>
		<java.version>15</java.version>
	</properties>

	<dependencies>		
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>		
	</dependencies>		
  
</project>

1) Spring Boot Application

package com.kangong;

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

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

2) SampleController

package com.kangong.sample.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SampleController {
	
	@GetMapping("/hello")
	public String[] hello() {
		return new String[] {"Hello","World"};
	}

}

3) http://localhost:8080/hello    호출

 

 

 

'개발 > Spring Boot' 카테고리의 다른 글

6.thymeleaf 설정  (0) 2021.02.11
5. Lombok 설정  (0) 2021.02.11
4. log4j2 설정  (0) 2021.02.07
3. jsp 연동  (0) 2021.02.07
2. MySql 연결  (0) 2021.02.06