Java(129)
-
Spring boot 소스 변경시 자동으로 restart하기
pom.xml에 아래 내용 추가 org.springframework.boot spring-boot-devtools runtime자동 build 설정: Project > Build Automatically 체크
2024.12.07 -
Java 이미지 타입 정보 얻기
import javax.imageio.ImageIO;import javax.imageio.ImageReader;import javax.imageio.stream.ImageInputStream;import java.io.File;import java.io.IOException;import java.util.Iterator;public class ImageTypeDetector { public static void main(String[] args) { String imagePath = "/path/to/your/image.jpg"; try { File imageFile = new File(imagePath); String formatNa..
2024.12.05 -
Spring boot 이미지 stream 또는 base64로 넘기기
StreamSpring bootimport org.springframework.core.io.Resource;import org.springframework.core.io.UrlResource;import org.springframework.http.HttpHeaders;import org.springframework.http.MediaType;import org.springframework.http.ResponseEntity;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.a..
2024.12.05 -
Spring boot 이미지 Map으로 전달하기
Spring boot@RestController@RequestMapping("/api")public class ResourceController { @GetMapping("/resource-with-map") public ResponseEntity> getResourceWithMap() throws IOException { // Load the resource (example: an image) Path imagePath = Paths.get("/path/to/your/image.jpg"); Resource resource = new UrlResource(imagePath.toUri()); if (!resource.exists() || !res..
2024.12.05 -
Spring boot URL로 access되지 않는 이미지 웹으로 전달하기
Spring bootimport org.springframework.core.io.Resource@RestController@RequestMapping("/images")public class ImageController { @GetMapping("/{imageName}") public ResponseEntity getImage(@PathVariable String imageName) throws IOException { Path imagePath = Paths.get("/path/to/your/private/images/" + imageName); Resource resource = new UrlResource(imagePath.toUri()); if (..
2024.12.05 -
STS Javascript 자동완성 지원 설정
Help > Install New Software.Update: https://download.eclipse.org/wildwebdeveloper/releases/latest/ Eclipse software repository | The Eclipse FoundationThe Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 360 open source projects, including runtimes, tools and frameworks.download.eclipse.org재시작
2024.12.01