일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- docker
- 자바
- 404error
- isNotEmpty
- java
- Kibana
- MariaDB
- Linux
- Javascript
- spring
- pem
- analytics4
- PostgreSQL
- IntelliJ
- iBatis
- Python
- 명령어
- 티스토리챌린지
- 오블완
- mssql
- pandas
- git
- SQL
- springboot
- mysql
- github
- 리눅스
- DBMS
- 호이스팅
- oracle
- Today
- Total
목록SPRING (78)
hanker
데이터 유형 중 int는 null 허용이 되지 않아서, int 대신 Integer를 사용해주면 된다. @Data public class voExam{ // 생략 private Integer boxIdx; }

Security 설정파일에 추가하면 밑의 코드를 추가하면 @Override public void configure(WebSecurity webSecurity) throws Exception{ webSecurity.ignoring() .requestMatchers(PathRequest.toStaticResources().atCommonLocations()); } 밑에 설정된 경로대로 static/ 하위폴더들 무시

List.of를 사용하려고 하는데, 오류가 발생했다. 내용을 보면 List안에 of메소드를 찾을 수 없다고 나오는데, 확인해보니 List.of는 java9 버전 이상부터 사용가능하다. 그래서 대신 Arrays.asList를 사용해서 처리했다. Arrays.asList와 List.of의 차이점은 분명히 있지만 어떤 방식에 사용하냐에 따라 다르다고 한다. 그래서 차이점을 찾아보고 알맞게 사용하시길..

1. TestVO 작성 @Data public class TestVO implements Serializable { private static final long serialVersionUID = 9203343211087202441L; @NotEmpty(message = "반드시 값이 존재하고 길이 혹은 크기가 0보다 커야합니다.") @Size(max = 100) private String test; } 2. TestController 작성 @Controller @RequestMapping("/test") public class TestController { @GetMapping public String testView(TestVO testVO){ return "test/testInput"; } @Pos..

- 배열의 크기보다 인덱스가 크거나 음수가 들어갔을때 나오는 오류 * 인덱스가 클 경우 public class ToStringTest { public static void main(String[] args) { // ar[4] = ar[0], ar[1], ar[2], ar[3] int[] ar = new int[4]; // ar에 값 넣기 for(int i = 0 ; i < ar.length ; i++){ ar[i] = i; } System.out.println(ar[4]); } } 가끔 실수할 때가 있다. 배열 인덱스는 0 ~ n-1

application.properties spring.thymeleaf.prefix=classpath:templates/ spring.thymeleaf.suffix=.html 작성 후 /resources/templates/* 파일을 바라보기 시작한다. Controller에서 코드를 작성 후 실행을 하면 /resources/templates/index.html 을 확인할 수 있다. 단, Spring boot로 프로젝트는 자동으로 resources/template 을 바라보지만 컨트롤러에서 Mapping URL을 지정해주지 않으면 resources/static 경로에있는 정적파일을 찾게 된다.

Log 사용 방법 Lombok - Slf4j LoggerFactory.getLogger(class) - Slf4j 사용 pom.xml org.projectlombok lombok pom.xml에 lombok dependency 추가 시 @Slf4j 어노테이션 사용가능 @Slf4j public class LogTest { public static void main(String[] args) { log.info("Log Test..."); } } - LoggerFactory.getLogger(class) public class LogTest { private static final Logger log = LoggerFactory.getLogger(LogTest.class); public static void..

이미지 파일은 각 날짜에 맞는 폴더에 저장 파일은 시간에 영향을 받아 저장( 파일명 - ex) 20210420_171013.050821_A.png ) 특정시간에 생성된 이미지 파일 불러오기 (파일명을 알 경우) @RestController public class ImageController { @GetMapping(value="/image/view", produces= MediaType.IMAGE_PNG_VALUE) public @ResponseBody byte[] getImage(@RequestParam("file_time") String fileTime, // yyyymmdd_HHmmssZ @RequestParam("value") String value) // A throws IOException{ ..

@ConfigurationProperties 어노테이션 사용중 갑작스러운 빨간알림이 생겼다. 우측에 보면 Open Documentation이라고 보이는데 클릭하면 docs.spring.io 사이트로 이동된다. 어떻게 처리할지 친절하게 알려준다. pom.xml org.springframework.boot spring-boot-configuration-processor true gradle.build dependencies { annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" } 적용하고 오류가 안사라지길래 File - Invalidate Caches 클릭해서 재실행 했더니 깔끔하게 사라졌다.

h2-console을 사용하여 개발을 진행하던 중 Spring security를 적용하니 갑자기 h2-console이 적용이 안된다. 음..? spring security를 적용하면서 h2-console/** 까지 막아버려서(?) 그렇다 설정파일에 h2-console을 허용 시켜보자 각자가 설정한 SecurityConfig 클래스를 보면 @Override protected void configure(HttpSecurity http) throws Exception{ http .authorizeRequests() .antMatchers("/","/**").access("permitAll") .antMatchers("/h2-console/**").permitAll() // 추가 .and() .csrf() //..