java - Spring boot creating configuration files when it should not -
i have excluded db related autoconfiguration in spring boot application. still trying create jdbctemplateconfiguration , failing not not finding datasources.
@enableautoconfiguration(exclude = {datasourceautoconfiguration.class, jmsautoconfiguration.class, mongoautoconfiguration.class, mongodataautoconfiguration.class, datasourcetransactionmanagerautoconfiguration.class, hibernatejpaautoconfiguration.class})
stacktrace
error - org.springframework.beans.factory.beancreationexception: error creating bean name 'jdbctemplate' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/datasourceautoconfiguration$jdbctemplateconfiguration.class]: bean instantiation via factory method failed; nested exception org.springframework.beans.beaninstantiationexception: failed instantiate [org.springframework.jdbc.core.jdbctemplate]: factory method 'jdbctemplate' threw exception; nested exception java.lang.illegalargumentexception: property 'datasource' required
spring boot docs describe 3 spring boot mechanisms how configure datasource
bean:
- embedded database -> add embedded db engine classpath
- standard sql data source -> configure jdbc access in configuration file
- jndi db access -> configured via configuration file
additionally can configure datasource
bean explicitly standard spring ioc mechanisms.
your error indicates non of these constructs defining datasource
bean exist in application.
Comments
Post a Comment