- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Bluemix 上运行时,如何在 MySQL 中创建云数据源?如果有可用的Java配置示例,请分享。如何让 Hibernate 创建表以及为什么会出现此错误?
Error creating bean with name 'entityManagerFactory' defined in com.covenant.app.config.root.DatabaseConfig: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.jdbc.datasource.DriverManagerDataSource]: : No qualifying bean of type [org.springframework.jdbc.datasource.DriverManagerDataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.jdbc.datasource.DriverManagerDataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
我的数据库配置类
@Configuration
@Profile("cloud")
@EnableTransactionManagement
public class CloudDatabaseConfig extends AbstractCloudConfig {
@Bean
public DataSource inventoryDataSource() {
return connectionFactory().dataSource("mysql");
}
@Bean(name = "namingStrategy")
public ImprovedNamingStrategy getNamingStrategy(){
ImprovedNamingStrategy namingStrategy = new CDCustomNamingStrategy();
return namingStrategy;
}
@Bean(name="dataSource")
public BasicDataSource dataSource() throws PropertyVetoException {
BasicDataSource bean = new BasicDataSource();
bean.setDriverClassName("com.mysql.jdbc.Driver");
bean.setUrl("jdbc:mysql://localhost:3306/bluemix?useUnicode=true&characterEncoding=UTF-8");
bean.setUsername("root");
bean.setPassword("root");
return bean;
}
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, ImprovedNamingStrategy ins) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setPackagesToScan(new String[]{"com.covenant.app.model"});
entityManagerFactoryBean.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
Map<String, Object> jpaProperties = new HashMap<String, Object>();
jpaProperties.put("database", "mysql");
jpaProperties.put("hibernate.hbm2ddl.auto", "update");
jpaProperties.put("hibernate.show_sql", "true");
jpaProperties.put("hibernate.format_sql", "true");
jpaProperties.put("hibernate.use_sql_comments", "true");
jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
jpaProperties.put("hibernate.ejb.naming_strategy", ins);
entityManagerFactoryBean.setJpaPropertyMap(jpaProperties);
return entityManagerFactoryBean;
}
}
我在 Bluemix 上的 manifest.yml
文件:
---
applications:
- name: lordthankyou
path: target/ideals.war
services:
- mysql
env:
SPRING_PROFILES_ACTIVE: cloud
我收到以下错误:
Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.covenant.app.dao.UserRepository com.covenant.app.services.UserService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined
最佳答案
终于我开始工作了,我刚刚添加了一个环境变量来激活manifest.yml中的云配置文件,并删除了扩展AbstractCloudConfig,因为它也在搜索mongodb。在这些更改之后,它开始工作,现在我可以在blue mix上运行spring mvc .
关于mysql - 如何在 Bluemix 上为 MySQL 配置云数据源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39190791/
我是 IBM Bluemix 的新手,到目前为止,应用程序(Spring-Hibernate-Rest App)运行在 Oracle 生态系统的 Tomcat Apache 服务器上,但由于一些需求变
我正在尝试使用Kubenetes插件安装最新的Bluemix容器服务。但是,我得到以下消息。跟着DOC - container service ocmbpro:~ ochen$ bx plugin i
我有一个连接 Bluemix Message Hub 的 liberty 应用程序。它在本地运行良好,但是当我从 Bluemix Liberty 运行 liberty 应用程序时,它永远不会运行。我正
我正在尝试连接 Bluemix Liberty 容器并使用 Bluemix session 缓存服务。 到目前为止我做了什么: 创建桥接应用程序并添加 session 缓存服务 创建 Liberty
我有一个部署到 IBM Bluemix (IBM Cloud) 的 Node JS Cloud Foundry 应用程序,我正在为它使用我自己的个人域。使用 letsencrypt 创建证书,我为 B
这是一个我要自己回答的问题,因为我已经看过无数次了,它确实应该算作一个FAQ。 假设您已经创建了一个 Flask 或 Django 应用程序,并且它在您的测试环境中工作 - 在 bluemix 之外和
我已经在 IBM Bluemix 上创建了一个 ClearDB MySQL 实例。我可以在不将实例绑定(bind)到 Bluemix 上运行的应用程序的情况下查看凭据(主机名、用户名、密码等)吗? 谢
我正在尝试使用 Bluemix 作为服务器开发一个 Android 应用程序。请向我展示示例代码以及从 android 客户端注册以将数据存储在 cloudant 数据库中的简单用例。我对安卓客户端很
我正在 Bluemix 中部署 node.js,基本上是从 parse.com 迁移到 Bluemix。 下面的错误是什么意思?我该如何解决?我正在使用 CF 命令行工具。下面附上日志。///////
我有一个 bluemix 应用程序,当前通过 PHP 使用 ClearDB MySQL 3rd party bluemix 服务进行设置。该服务运行良好,但我注意到免费版本的空间限制为 5mb(您可以
我们尝试通过运行来测试 IBM Bluemix Cloud 和 Watson Cloud 我们帐户中的几个 Watson Cloud 演示 node.js 应用程序,我们 注意到以下情况: 在我们的帐
我有一个在 IBM Bluemix 上运行的简单 JSF 应用程序,与以下 J2EE 依赖项配合良好。 javax javaee-web-api 6.
我正在使用公共(public) Bluemix。我在 Bluemix 中使用我的 IBM ID 供应了一个 dashDB 服务实例。我还提供了对象存储服务。我想将文件从对象存储加载到 dashDB。
每个组织是否允许多个空间? 空间是用来分隔项目的吗? 在 Bluemix 上使用组织和空间的最佳实践是什么? 通过 eclipse : 通过浏览器: 最佳答案 居然还有Bluemix document
我在登录 IBM Bluemix 时遇到注册失败即使我创建了一个 IBM 有效帐户。我已经提供了我的电话号码和有效的电子邮件地址。我通过 Bluemix 中的有效 IBM ID 登录。 最佳答案 st
当我尝试将公共(public) IP 地址分配给我的容器时(这是一个 Nginx 代理容器,因此我公开了端口 80 和 443),我在让公共(public) IP 地址实际工作方面遇到了相当大的问题。
有谁知道为什么 NodeJS 实例会在 Next tick 或 Mongoose pre 错误时崩溃?当我们努力识别所有错误时,有哪些想法可以创建更稳定的应用程序? IBM 是否计划提高弹性? 我想我
我正在尝试创建一个移动应用程序并使用一些 Bluemix 服务。 我在我的 bluemix 帐户中看到“移动”部分,其中包括: 移动应用内容管理器 移动客户端访问 移动基础 移动质量保证 推送通知 动
我有一个纯 Java 应用程序,目前使用基于 .jks 的 key 和信任库。据我了解,Bluemix 下的 SSL 协议(protocol)处理是在网络端使用单个端口和用于主机和域标识的通配符证书完
我正在使用 IBM Bluemix 开发一个 CF 应用程序。提供服务并将其绑定(bind)到应用后,是否需要它提供的凭据引用可公开访问的 URL 或 IP 地址? 我问是因为我一直在试验 Cloud
我是一名优秀的程序员,十分优秀!