Circular placeholder reference 'jdbc.driverClassName' in property definitions
来源:互联网 发布:linux 下载整个文件夹 编辑:程序博客网 时间:2024/06/05 16:20
- 在maven 多个module 开发时,父pom中定义字段,子pom或者properties引用,出现Circular placeholder reference 循环引用的问题。
解决方法:在项目上右键选properties,选择Deployment Assembly,删除src/main/resources选项。
原因:参考http://virgoooos.iteye.com/blog/351737
maven在编译后能够正确的替换变量,eclipse在部署的时候,会将src/main/resources文件覆盖回来。造成循环引用。如果删除deploy assembly 中src/main/resources选项,则在部署时候会忽略resources文件夹。
下面举例:
parent.pom分别定义测试和生产环境的switch变量,
子项目中properties引用parent.pom 的switch变量
子项目中xml中应用properties的switch变量
parent.pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>1.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>fms-parent</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>fms-parent</name> <!-- 预定义版本号 --> <properties> <spring.version>5.0</spring.version> </properties> <!-- 依赖预定义,子项目不依赖不生效 --> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> </dependencies> </dependencyManagement> <build> <!--替换子项目的文件 --> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> </includes> <filtering>true</filtering> </resource> </resources> <testResources> <testResource> <directory>src/test/resources</directory> <includes> <include>**/*.properties</include> </includes> <filtering>true</filtering> </testResource> </testResources> <plugins> <!-- 定义插件 --> <plugin> </plugin> </plugins> </build> <profiles> <profile> <!-- 测试环境,定义相关的属性 --> <id>test</id> <properties> <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver> <switch>false</switch> </properties> </profile> <profile> <!-- 生产环境,定义相关的属性 --> <id>product</id> <properties> <jdbc.driver>com.oracle.jdbc.Driver</jdbc.driver> <switch>true</switch> </properties> </profile> </profiles></project>
子项目application.properties
switch=${switch}
子项目application.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/> <property name="ignoreResourceNotFound" value="true"/> <property name="locations"> <list> <value>classpath:application.properties</value> <value>classpath:*.properties</value> </list> </property> </bean> <bean id="testBean" class="com.test"> <property name="switch" value="${switch}"></property> </bean></beans>
0 0
- Circular placeholder reference 'jdbc.driverClassName' in property definitions
- Circular placeholder reference 'jdbc.driver' in property definitions
- spring:Circular placeholder reference 'XXX' in property definitions
- spring:Circular placeholder reference 'XXX' in property definitions
- java.lang.IllegalArgumentException: Circular placeholder reference 'server.port:**' in property
- Could not resolve placeholder 'jdbc.driverClassName' in string value "${jdbc.driverClassName}
- 报错Could not resolve placeholder 'jdbc.driverClassName' in string value "${jdbc.driverClassName}
- Could not resolve placeholder 'jdbc.driverClassName' in string value "${jdbc.driverClassName}错误
- Could not resolve placeholder 'driverClassName' in string value "${driverClassName}"
- 'RequiredTargetFramework' property in 'Reference' tag
- 连接mysql报错Property ‘driverClassName’ threw exception :could not load jdbc driver
- Circular Reference with Blocks
- Cannot load JDBC driver class ${jdbc.driverClassName}
- spring 整合mybatis找不到${jdbc.driverClassName}
- Could not load JDBC driver class [${driverClassName}]
- gson circular reference error问题
- context:property-placeholder
- context:property-placeholder
- JMeter出现“the target server failed to respond“的解决办法
- 获取Revit中所打开的View
- 防止用户将表单重复提交的方法汇总
- Unity 宏定义
- const引用
- Circular placeholder reference 'jdbc.driverClassName' in property definitions
- linux使用--8.dot 画流程图的hello world
- 共享内存,共享缓冲区 一对多
- Python 监控Oracle alert log
- java Robot 类模拟键盘按键和鼠标点击(全局模拟)
- 浏览器页面的缓存设置(不缓存设置)
- 如何搭建你的git server
- Select2在使用ajax获取远程数据时显示默认数据
- 一、YARN 架构由什么组成?