0
는 내가 알 수 있도록봄 자동 등록
@Component
@PropertySource(value = "file:${user.home}/.cooperp/app-conf.properties")
public class ApplicationProperties {
@Value("${mysql-location}")
private String mysqlLocation;
public String getMysqlLocation() {
return mysqlLocation;
}
public void setMysqlLocation(String mysqlLocation) {
this.mysqlLocation = mysqlLocation;
}
}
같은 @PropertySource
를 사용하여 속성 파일을 표현하는 간단한 클래스가 파일 만들기 파일은 하나의 부재를 무시하는 봄 것 ignoreResourceNotFound = true
을 추가하고를 시동 할 수없는 경우 신청.
봄에 을 작성 하시겠습니까? 파일을 만들거나 무시하거나 예외를 throw하지 마십시오.
'@ PropertySource'의 작업/기능이 아닌 코드를 작성해야합니다. –
어디에서 주요 방법입니까? –
왜이 작업을 수행 하시겠습니까? – PaulNUK