본문 바로가기
728x90

전체 글86

Spring boot 외부 설정의 우선순위 우선순위 홈 디렉토리에 있는 spring-boot-dev-tools.properties 테스트에 있는 @TestPropertySource ex)@TestPropertySoruce(properties="SangGuk1") @SpringBootTest 의 properties attribute ex)@SpringBootTest(properties="SangGuk1") 정의해야할 properties가 많은 경우 @SpringBootTest(locations = "classpaath:/경로) 커맨드 라인 아규먼트 SPRING_APPLIVATION_JSON(환경 변수 또는 시스템 프로퍼티)에 들어있는 프로퍼티 ServletConfig 파라미터 ServletContext 파라미터 java:comp/env JNDI a.. 2022. 2. 5.
java.lang.IllegalStateException: Failed to load ApplicationContext java.lang.IllegalStateException: Failed to load ApplicationContext ... Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springRunner': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'my.age' in value "${my.age}" java.lang.IllegalStateException: Failed to load Appli.. 2022. 2. 5.
org.junit.runners.model.InvalidTestClassError org.junit.runners.model.InvalidTestClassError: Invalid test class 'com.example.studyspringboot.StudyspringbootApplicationTests': 1. No runnable methods at org.junit.runners.ParentRunner.validate(ParentRunner.java:525) at org.junit.runners.ParentRunner.(ParentRunner.java:92) at org.junit.runners.BlockJUnit4ClassRunner.(BlockJUnit4ClassRunner.java:74) at org.springframework.test.context.junit4.Spr.. 2022. 2. 5.
Spring boot 외부 설정 - application.properties : Spring boot가 application을 구동할 때 자동으로 로딩하는 파일 이름 key=value 형식으로 정의 ${random.*} 으로 랜덤값을 설정할 수 있음 플레이스 홀더 ex) name = SangGuk fullname = ${name} Park - yaml - 커맨드 라인 아규먼트 : 터미널에서 jar파일 실행 시 정의 ex) java -jar target/파일명.jar --user.name=SangGuk - OS 환경변수 : 환경변수에 SPRING_APPLIVATION_JSON로 정의해둔 값 ref : https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-fe.. 2022. 2. 5.
728x90