org.springframework.beans.factory.UnsatisfiedDependencyException : Error creating bean with name ~
//아래와 같이 클래스를 작성하고
//컨트롤러에서 사용할때 해당 클래스가 빈으로 등록되어있지 않을 경우 발생할 수 있다
@Data
@ConfigurationProperties(prefix = "properties")
public class Properties {
private String key;
}
@Controller
@RequiredArgsConstructor
public class Controller {
private Properties props;
}
//아래와 같이 빈으로 등록해주면 해결된다.
@Data
@component
@ConfigurationProperties(prefix = "properties")
public class Properties {
private String key;
}
@Controller
@RequiredArgsConstructor
public class Controller {
private Properties props;
}