스프링 부트 웹 화면 출력해보기

NB_ Allen·2021년 1월 19일
0

스프링 부트

목록 보기
3/6
package com.rubypaper.controller;

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

//문자열이 그대로 브라우저로 출력.
@RestController
public class BoardController {
	public BoardController() {
		System.out.println("BoardController 생성하기");
	}
	
   // @RequestMapping(value="/hello", method=RequestMethod.GET) 와 동일 
   @GetMapping("hello")
   public  String  hello( String  name ) {
	   return  "HELLO : " + name;
   }
}
# 이름 규칙 
# web-application-type ( 대소문자를 구분 안하는 경우 )
# webApplicationType ( 대소문자를 구분 하는 경우 )

# 우선순위가 application.properties 가 높다. 

# 톰캣 PORT 번호 
server.port=8088

# 서블릿 또는 자바애플릿 선택 ( none , SERVLET )
spring.main.web-application-type=SERVLET

# " none " or " console "   배너 설정
spring.main.banner-mode=console
spring.banner.location=banner/banner.txt

http://localhost:8088/hello?name=allen
설정해둔 포트번호/(@getmapping에 설정한값)hello?name="원하는값" 으로 웹접속

0개의 댓글