0
@ConfigurationProperties의 사용법을 이해하는 데 문제가 있습니다. 내 응용 프로그램 속성 파일에서 모든 변수는 노란색 밑줄이있는 "알 수없는 속성"입니다. 나는 응용 프로그램을 실행하지만 같은 일이 발생합니다. application.properties의 구성을 내 데이터 소스 함수에 연결하는 방법이 있습니까?configurationproperties는 알 수없는 속성입니다.
나는 그것이 잘 작동하지만 내가
# Primary DataSource configuration
app.datasource.url=jdbc:mysql://127.0.0.1/trs?useSSL=false
app.datasource.username=user
app.datasource.password=pass
내 기본 파일이
내 application.properties를 작동하지 않을 것입니다 app.datasource.url 사용
spring.datasource.url = jdbc:mysql://127.0.0.1/trs?useSSL=false
를 사용하는 경우 .java 파일
@ConfigurationProperties(prefix="app.datasource")
@Primary
@Bean
public DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://127.0.0.1/trs?useSSL=false");
dataSource.setUsername("user");
dataSource.setPassword("pass");
return dataSource;
}
여기에 무슨 문제가 있습니까? 응용 프로그램을 시작할 수 없거나 IDE에 몇 가지 오류 메시지가 표시됩니까? – pvpkiran