본문 바로가기
728x90
반응형

IT/Spring42

[Spring] - 스프링 자바 api RequestEntity, ResponseEntity 클래스 사용 방법 #스프링 자바 api RequestEntity, ResponseEntity 클래스 사용 방법 #RequestEntity -RequestEntity(T body, MultiValueMap headers, HttpMethod method, URI url, Type type) -Spring framework에서 제공하는 HttpEntity 클래스의 상속클래스입니다. -url 요청을 보낼 때 사용합니다. -header, body, method, url, type을 생성자 파라미터로 넘길 수 있습니다. #ResponseEntity -ResponseEntity(T body, MultiValueMap headers, HttpStatus status) -Spring framework에서 제공하는 HttpEntity 클.. 2022. 6. 28.
[Spring] - 스프링 URI 생성 UriComponents, UriComponentsBuilder 클래스 사용 방법 #스프링 URI 생성 UriComponents, UriComponentsBuilder 클래스 사용 방법 #참고 소스 @Override public String getName() { URI uri = UriComponentsBuilder .fromUriString("http://localhost:8080") .path("/api/server/name") .queryParam("name", "jack") .build() .toUri(); RestTemplate restTemplate = new RestTemplate(); ResponseEntity responseEntity = restTemplate.getForEntity(uri, String.class); LOGGER.info("status code : .. 2022. 6. 28.
[Spring] - 스프링 RestTemplate, RestTemplateBuilder 클래스 사용 방법 #스프링 RestTemplate, RestTemplateBuilder 클래스 사용 방법 #RestTemplate이란 -스프링3부터 지원하는 HTTP 통신 기능을 쉽게 사용할 수 있게 설계되어 있는 템플릿입니다. REST API 호출이후 응답을 받을 때까지 기다리는 동기방식으로 처리되며 RESTful 방식을 지키고 있습니다. #RestTemplateBuilder -빈 생성시 사용합니다. #RestTemplate 관련 주요 메소드 메소드 HTTP 설명 getForObject GET GET 형식으로 요청하며 객체로 결과값을 반환받습니다. getForEntity GET GET 형식으로 요청하며 ResponseEntity로 결과를 받환받습니다. postForObject POST POST 형식으로 요청하며 객체로 .. 2022. 6. 28.
[Spring] - 스프링 pom.xml Failure to transfer org.apache.maven.plugins:maven-assembly-plugin:pom:2.2-beta-5 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of.. #스프링 Failure to transfer org.apache.maven.plugins:maven-assembly-plugin:pom:2.2-beta-5 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-assembly-plugin:pom:2.2-beta-5 from/to central (htt.. 2022. 6. 26.
[Spring boot] - 스프링 부트 Web server failed to start. Port 8080 was already in use 에러 해결 방법 #스프링 부트 Web server failed to start. Port 8080 was already in use 에러 해결 방법 -8080포트가 다른곳에서 이미 사용중일때 나는 에러입니다. -해당 포트를 사용하는 프로세스를 찾아서 강제 종료 처리해줍니다. 1. 명령프롬프트(CMD) 실행 -window키 + R -> cmd 입력 후 확인 버튼을 클릭합니다. 2. netstat -ano 명령어 입력 내 PC에서 사용하고 있는 포트 확인 -8080포트를 사용중인 프로세스 아이디(PID) 확인합니다. 3. taskkill 명령어로 8080포트를 사용하고 있는 프로세스 강제 종료 -taskkill /pid 18140 /f 2022. 6. 3.
[Spring] - 스프링 시큐리티(Spring Security) 한글 처리 하는 방법 (CharacterEncodingFilter) #스프링 시큐리티(Spring Security) 한글 처리 하는 방법 (CharacterEncodingFilter) -CharacterEncodingFilter 를 사용해서 한글 인코딩 설정을 할 수 있습니다. @Configuration @EnableWebSecurity @Log4j public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { // 한글 처리 CharacterEncodingFilter filter = new CharacterEncodingFilter(); filter.setEncoding("UTF-8".. 2022. 3. 15.
728x90
반응형