728x90 Spring Boot37 Properties 관리 @ConfigurationProperties 1. 클래스 정의 @ConfigurationProperties("sangguk") @Component @Data public class SangGukProperties { private String name; private int age; private String fullName; } * 클래스 정의 후 빌드 시 application.properties에서 자동완성으로 사용 가능 2. properties 정의 sangguk.name=SangGuk sangguk.age=${random.int(0,100)}//random.int(범위) 란듐 sangguk.full-name=PackSangGuk * 범위에 공백이 있으면 안되며 properties 내에서는 모두 문.. 2022. 2. 14. 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. 이전 1 ··· 3 4 5 6 7 8 9 10 다음 728x90