spring-boot: - auto konfigurieren-Transaktions-manager

Scheint, wie ich bin etwas fehlt: Automatisches Einspritzen einer Datenquelle funktioniert, aber die Injektion von DataSourceTransactionManager ausfällt.

Abhängigkeiten:

<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>1.2.1.RELEASE</version>
</parent>
<dependencies>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
  </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
    </dependency>
</dependencies>

Code:

@SpringBootApplication
public class MainApplication {

  @Autowired
  private DataSource dataSource;

  //this fails
  @Autowired
  private DataSourceTransactionManager transactionManager;

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

Ich erwartet, dass die DataSourceTransactionManagerAutoconfiguration würde es kümmern, aber das ist es nicht. Irgendwelche Hinweise?

Die Probe ist auf github: https://github.com/jangalinski/springboot-playground

InformationsquelleAutor Jan Galinski | 2015-02-22
Schreibe einen Kommentar