BackEND/Java 28

spring boot gradle 셋팅

maven만 사용하다가 이번엔 gradle을 사용해 보기로 했다. gradle에서 제일 중요한 설정은 build.gradle 인것 같다. 1. build.gradle 설정 buildscript { ext { springBootVersion = '2.3.4.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'org.springframework.boot' apply plugin: 'io.spri..

BackEND/Java 2020.12.04

utc 날짜 파싱하는 방법

아래와 같은 메소드를 쓰면 UTC로 받은 날짜 String을 yyyy-MM-dd HH:mm:ss 로 변환할수 있다. private String convertUTC(String dtString){ String dtString = "2019-05-02T02:12:42"; SimpleDateFormat transFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); transFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date dt = null; try { dt = transFormat.parse(dtString); } catch (ParseException e) { e.printStackTrace(); } SimpleDa..

BackEND/Java 2019.05.03

mac 주소 가져오기.

public class MacAddressTest { public static void main(String[] args) { try { InetAddress addr = InetAddress.getLocalHost(); /* IP 주소 가져오기 */ String ipAddr = addr.getHostAddress(); System.out.println(ipAddr); /* 호스트명 가져오기 */ String hostname = addr.getHostName(); System.out.println(hostname); /* NetworkInterface를 이용하여 현재 로컬 서버에 대한 하드웨어 어드레스를 가져오기 */ NetworkInterface ni = NetworkInterface.getByInet..

BackEND/Java 2017.11.30