精华内容
下载资源
问答
  • 2021-06-15 05:13:05

    spring.datasource.name 和spring.datasource.username

    所踩的坑
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
    spring.datasource.url=jdbc:mysql://localhost:3306/thread?useSSL=false&useUnicode=true&characterEncoding=UTF-8
    spring.datasource.username=root
    spring.datasource.password=ying.115

    以上的是正确的用法
    而这个却不知道有什么当你用idea的时候。用提示里给的选择会有这个。
    我也看过源码却实不知里面的作用。这个让我也很头痛。也让我踩了一个大坑所以我记录一下
    spring.datasource.name=

    更多相关内容
  • 原因 由于 Git 的分支切换问题,导致需要重新导入 JDK ,而且, IDEA 没有自动识别当前项目为 Maven 管理的项目,所以需要重新导入一下。 解决办法 看一下自己是不是 Maven 项目,点击 IDEA 下图中的1,然后看一下3...

    原因

    由于 Git 的分支切换问题,导致需要重新导入 JDK ,而且, IDEA 没有自动识别当前项目为 Maven 管理的项目,所以需要重新导入一下。

    解决办法

    看一下自己是不是 Maven 项目,点击 IDEA 下图中的1,然后看一下3有没有,如果没有,可以分别点一下2的两个按钮,看有了没有:
    在这里插入图片描述
    如果没有的话,你可以去 pom.xml 文件里,右击,看能够重新引入依赖,如果没有相应的按钮,你会看到提示添加此项目为Maven项目的按钮,点击就可以了。

    当然,如果你还不是这种情况的话,你可以尝试一下: clean 并重新编译一下项目,记住这个思路就没错了。

    展开全文
  • 参考:http://120.203.18.89:6969/41/could-not-resolve-placeholder-spring-datasource-url-in-value-spring-datasource-url/ 今天在测试环境运行Maven工程时,出现莫名其妙的无法初始化mybatis错误,主要是读取不...

    参考:http://120.203.18.89:6969/41/could-not-resolve-placeholder-spring-datasource-url-in-value-spring-datasource-url/

    今天在测试环境运行Maven工程时,出现莫名其妙的无法初始化mybatis错误,主要是读取不到配置文件里面,关于数据库的配置。

    工程有多个profile,在Idea里面设置了运行时的配置文件,但是运行时没有生效。

    最后通过修改Maven解决,不用自带的Maven。

    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mybatisConfig': Unsatisfied dependency expressed through field 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'druidConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1325) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1291) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1193) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	... 45 common frames omitted
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'druidConfig': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:379) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1344) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1250) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	... 61 common frames omitted
    Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"
    	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211) ~[spring-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:839) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1086) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.5.RELEASE.jar:5.0.5.RELEASE]
    	... 81 common frames omitted
    

     

    展开全文
  • spring.datasource.urlspring.datasource.jdbc-url

    万次阅读 多人点赞 2018-05-11 16:35:39
    今天使用spring boot配置两个数据源,出现了...app.datasource.url=jdbc:mysql://localhost/test app.datasource.username=dbuser app.datasource.password=dbpass app.datasource.driverClassName=com.mysql.cj.jdb...

    今天使用spring boot配置两个数据源,出现了问题。

    使用数据源配置

    app.dataource.url=jdbc:mysql://localhost/test
    app.datasource.username=dbuser
    app.datasource.password=dbpass
    app.datasource.driverClassName=com.mysql.cj.jdbc.Driver提示我:jdbcUrl is required with driverClassName。

    上网搜了一下,结果是使用app.datasource.url的锅。

    spring.datasource.url 数据库的 JDBC URL。

    spring.datasource.jdbc-url 用来创建连接的 JDBC URL。

    官方文档的解释是:

    因为连接池的实际类型没有被公开,所以在您的自定义数据源的元数据中没有生成密钥,而且在IDE中没有完成(因为DataSource接口没有暴露属性)。另外,如果您碰巧在类路径上有Hikari,那么这个基本设置就不起作用了,因为Hikari没有url属性(但是确实有一个jdbcUrl属性)。在这种情况下,您必须重写您的配置如下:

    app.datasource.jdbc-url=jdbc:mysql://localhost/test
    app.datasource.username=dbuser
    app.datasource.password=dbpass
    
    展开全文
  • 1.要确保你的配置的文件字符格式无误,确保文件存在 2.项目在配置更改后要对maven进行clean,install的操作,清除以重新编译项目 选择项目 Run As
  • spring.datasource.url:本地连接URL简写

    千次阅读 2020-08-07 16:28:11
    spring: datasource: url: jdbc:mysql:///database-name username: root password: root
  • Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured. Reason: Failed to determine a suitable driver class Action: ...
  • 项目启动报错:Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"项目在配置更改后要对maven进行clean,install的操作,清除以重新编译项目...
  • 解析mysql的spring.datasource.url获取host,端口,数据库名,获取表里的 字段名,字段类型,字段注释 做项目做了一个功能:需要展示一个表中的所有信息:字段名,字段类型,字段注释。 需要解析mysql的url,获取到...
  • Spring Cloud Config Server服务启动报错,如下所示: 2020-04-25 10:10:22.089 INFO 4028 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation....
  • spring: profiles: active: dev datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:4406/demo?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=...
  • spring.datasource.url=jdbc:mysql://abc:3306/abcd?useUnicode=true&characterEncoding=utf8 很常规地配置了这个mysql的url后发现报错 Wed Oct 24 14:59:16 CST 2018 WARN: Establishing SSL connection ...
  • spring.datasource.schema配置

    万次阅读 2019-05-22 11:42:12
    用springboot2.0执行sql脚本: 1.现将sql文件放在resources下的sql文件夹下 ...spring: datasource: # 数据源基本配置 username: root password: 123 driver-class-name: com.mysql.cj.jdbc.Driver ...
  • 关于使用spring.datasource.hikari连接数据库找不到找不到url的问题applica.properties里配置连接数据库使用hikari出现的问题异常解决 配置重定义识别数据库连接方式为spring.datasource.primary完美解决 ...
  • 报错信息'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.原因数据库没有配置,在启动的文件的注解@SpringBootApplication中加入参数@SpringBootApplication...
  • 这个错误的大致意思就是说,未能自动配置数据源:未指定“spring.datasource.url”,并且无法自动配置嵌入的数据源。 如果当前项目中不需要使用数据源,且触发了数据源配置则会报这样的错误。其原因是提供API的依赖...
  • configure a DataSource: 'spring.datasource.url'

    千次阅读 2018-08-10 16:51:10
    Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.   今天解决了一个springboot jpa的通用数据库配置BUG,记录一下,...
  • ##解决spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver出错 ###idea project->右键->open module setting->libraries->+号->导入本地的mysql包即可 在此感谢...
  • springboot整合druid时,引入了druid的数据源,在配置文件application.yml中...spring: datasource: username: root password: 123456 url: jdbc:mysql://192.168.2.218:3306/test driver-class-name: com.mysq...
  • Failed to bind properties under 'spring.datasource.password' to java.lang.String: Reason: Failed to bind properties under 'spring.datasource.password' to java.lang.String Action: Update your ...
  • 今天倒腾了一下自己的SpringBoot demo的代码,发现启动报了如下的错误: *************************** APPLICATION FAILED TO START ...Failed to auto-configure a DataSource: 'spring.datas...
  • Failed to bind properties under 'spring.datasource.password' to java.lang.String: Reason: Failed to bind properties under 'spring.datasource.password' to java.lang.String Action: Update your ...
  • 1.使用springboot jdbc初始化数据库 ...spring: datasource: username: xuhaixing password: xuhaixing url: jdbc:mysql://192.168.94.151:3306/mytest?useUnicode=true&characterEncoding=utf8&charac...
  • 项目结构: DruidConfig: package ... ...import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.support.http.StatViewServlet; import com.alibaba.druid.support....
  • url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai driver-class-name: com.mysql.cj.jdbc.Driver username: root passwo
  • 如何解决spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver无法引用,如下: 解决方案,在pom.xml找到自动创建项目时导入的mysql .jar包 <!-- mysql--> <dependency> <groupId&...
  • Error processing condition on com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration.dynamicDataSourceCreator 解决办法: 引入这两个包 在这里插入代码片 <...
  • springboot2.x整合druid数据源时,在配置文件中配置spring.datasource.type 属性时,不能识别 com.alibaba.druid.pool.DruidDataSource,并且启动报错 错误: rror starting ApplicationContext. To display ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 227,077
精华内容 90,830
关键字:

spring.datasource.url怎么写

spring 订阅
友情链接: sqlserver.zip