を見つけない:春ブーツJPAは、私は次のように構成されたスプリングブートアプリケーション持つデータソース
アプリケーションを
@SpringBootApplication(exclude = {ErrorMvcAutoConfiguration.class,
DataSourceAutoConfiguration.class,JpaRepositoriesAutoConfiguration.class})
public class Application extends SpringBootServletInitializer {
メインコンフィギュレーションクラス:
@Configuration
@ComponentScan("com.mycompany.it")
@Import(DatabaseConfiguration.class)
public class Configuration extends WebMvcConfigurationSupport {
データベース構成:
@Configuration
@ComponentScan(basePackages = {"com.mycompany.it.xp2.integration.workday.dao","com.mycompany.it.xp2.integration.workday.application","com.company.it.xp2.integration.workday.model"})
@EnableAspectJAutoProxy
@EnableTransactionManagement
@EnableJpaRepositories(basePackages = {"com.company.it.xp2.integration.workday.dao","com.company.it.xp2.integration.workday.model"})
public class DatabaseConfiguration {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
compile group: 'org.springframework', name: 'spring-orm'
compile group: "org.springframework.boot", name: "spring-boot-starter-jdbc"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
春ブーツ:ここ
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.sql.DataSource' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
のGradleから関連する行されている:私は、私は次のエラーを取得するアプリケーションを起動しかし
@Bean(destroyMethod = "close")
@Primary
public DataSource dataSource() throws PropertyVetoException {
ComboPooledDataSource source = new ComboPooledDataSource();
source.setDriverClass(driverClass);
source.setJdbcUrl(jdbcUrl);
source.setUser(jdbcUsername);
source.setPassword(jdbcPassword);
source.setInitialPoolSize(initialSize);
source.setMaxPoolSize(maxActive);
source.setMinPoolSize(minIdle);
return source;
}
:データソースのBean宣言でバージョン1.5.3
プロジェクトの依存関係を投稿して、データベースコネクタの依存関係を追加してください。 –
なぜ、Spring Auto LoaderからDataSourceAutoConfiguration.classを除外していますか? – emeraldjava
パスワードをソースコードにチェックインしないというポリシーがあり、複数のプロジェクトが同じtomcatインスタンスを共有しているため、tomcat環境設定でspring.jdbc.passwordプロパティを使用するだけではなりません – user439407