Код: Выделить всё
Description:
Parameter 0 of method hikariDataSource in xxx.DatabaseConfiguration required a bean of type 'org.springframework.boot.autoconfigure.jdbc.DataSourceProperties' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.boot.autoconfigure.jdbc.DataSourceProperties' in your configuration.
В классе приложения я деактивирую автоматическую конфигурацию:
Код: Выделить всё
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
< /code>
Я определяю свою собственную конфигурацию: < /p>
@Configuration
public class DatabaseConfiguration {
@Bean
@ConfigurationProperties(prefix = "spring.datasource.hikari")
public HikariDataSource hikariDataSource(DataSourceProperties properties) {
HikariDataSource hikariDataSource = createDataSource(properties, HikariDataSource.class);
if (StringUtils.hasText(properties.getName())) {
hikariDataSource.setPoolName(properties.getName());
}
return hikariDataSource;
}
protected static T createDataSource(DataSourceProperties properties, Class
Подробнее здесь: [url]https://stackoverflow.com/questions/79667554/spring-boot-3-5-0-datasourceproperties-not-defined[/url]