Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-configuration of Spring Integration's JDBC support does not use the auto-configured DataSource #14175

Closed
garyrussell opened this issue Aug 22, 2018 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@garyrussell
Copy link
Contributor

With Boot 2.0.4:

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-integration</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.integration</groupId>
			<artifactId>spring-integration-jdbc</artifactId>
		</dependency>

		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
@SpringBootApplication
public class Igh25431Application {

	public static void main(String[] args) {
		SpringApplication.run(Igh25431Application.class, args);
	}

	@Bean
	public JdbcMessageStore store(DataSource dataSource) {
		return new JdbcMessageStore(dataSource);
	}

}
spring.datasource.url=jdbc:mysql://localhost/integration
spring.datasource.username=root
#spring.datasource.password=dbpass
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

spring.integration.jdbc.initialize-schema=always

logging.level.root=debug
2018-08-22 14:12:42.704 DEBUG 64743 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'store'
2018-08-22 14:12:42.704 DEBUG 64743 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating instance of bean 'store'
2018-08-22 14:12:42.704 DEBUG 64743 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
2018-08-22 14:12:42.704 DEBUG 64743 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'igh25431Application'
2018-08-22 14:12:42.705 DEBUG 64743 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'dataSource'
2018-08-22 14:12:42.705 DEBUG 64743 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Creating instance of bean 'dataSource'
...
2018-08-22 14:12:42.744 DEBUG 64743 --- [           main] com.zaxxer.hikari.HikariConfig           : Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@764c12b6
...
2018-08-22 14:12:42.765 DEBUG 64743 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Finished creating instance of bean 'dataSource'
   IntegrationAutoConfiguration.IntegrationJdbcConfiguration:
      Did not match:
         - @ConditionalOnSingleCandidate (types: javax.sql.DataSource; SearchStrategy: all) did not find any beans (OnBeanCondition)
      Matched:
         - @ConditionalOnClass found required class 'org.springframework.integration.jdbc.store.JdbcMessageStore'; @ConditionalOnMissingClass did not find unwanted class (OnClassCondition)

Clearly we have a DataSource but auto config doesn't find it for some reason.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 22, 2018
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 23, 2018
@snicoll snicoll added this to the 2.0.x milestone Aug 23, 2018
@snicoll snicoll self-assigned this Aug 23, 2018
@snicoll
Copy link
Member

snicoll commented Aug 23, 2018

Thanks for the report. The auto-configurations aren't properly ordered.

@snicoll snicoll modified the milestones: 2.0.x, 2.0.5 Aug 23, 2018
@wilkinsona wilkinsona changed the title Spring Integration/JDBC AutoConfiguration Auto-configuration of Spring Integration's JDBC support does not use the auto-configured DataSource Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants