我无法使用JPA在春季启动访问MySQL在春季启动无法访问MySQL
我是新的春季引导和春季。
我得到了误差小于
Description:
Parameter 0 of constructor in org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
- Bean method 'dataSource' not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
- Bean method 'dataSource' not loaded because @ConditionalOnBean (types: org.springframework.boot.jta.XADataSourceWrapper; SearchStrategy: all) did not find any beans
Action:
Consider revisiting the conditions above or defining a bean of type 'javax.sql.DataSource' in your configuration.
我application.properties文件有如下行
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/mydatabase
spring.datasource.username=root
spring.datasource.password=mypassword
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
的错误是我能想到的是春天启动的抱怨,我没有”看t set(spring.datasource.jndi-name)属性.....我认为这是不必要的,因为我已经给出登录凭据的数据源url &。
我不知道我应该给spring.datasource.jndi-name。
我很感激任何帮助。我对此感到震惊。
显示你的'pom.xml',你的类路径中是否有MySQL驱动程序? – Artegon
这非常有趣。你能够在某个地方分享样本,我想了解为什么其他条件不在此处列出。 –
感谢您的回复。 –