I recently run on a weird problem while running property filtering on tutorial project that I'm writing.
One of my configuration files (spring XML config files) was being partially filtered (only the first 2 variables were properly "filtered" while the rest was left as they were )
Below is my configuration file. Only the first 2 variables where filtered (mongo.host & mongo.port) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<!--xml version="1.0" encoding="UTF-8" standalone="no"?--> < beans xmlns = "http://www.springframework.org/schema/beans" xmlns:context = "http://www.springframework.org/schema/context" xmlns:mongo = "http://www.springframework.org/schema/data/mongo" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation = "http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" > < mongo:mongo host = "${mongo.host}" port = "${mongo.port}" id = "mongo" > <!--Search for classes annotated with @Repository--> < mongo:repositories base-package = "com.ufasoli.core.repositories" repository-impl-postfix = "Impl" > < context:annotation-config > < bean id = "mongoTemplate" class = "org.springframework.data.mongodb.core.MongoTemplate" > < constructor-arg ref = "mongo" name = "mongo" > < constructor-arg name = "databaseName" value = "${mongo.db}" > </ constructor-arg ></ constructor-arg ></ bean > </ context:annotation-config ></ mongo:repositories ></ mongo:mongo ></ beans > |
I've tried a few things and realized that if I moved them around then suddenly it would work but I couldn't put my finger on what was causing the problem
So I decided to remove line by line from the bottom up and check if something will fix the problem
As it turns out what was causing the problem was the '@' in my comment right before the repository configuration.
This actually was a maven bug in the maven-resources-plugin but fear not the bug was corrected in the 2.6 version
So if you come up by this behavior check your pom.xml configuration as by default my maven was using the 2.4.1 version and change it in the build section of your POM to use the more recent version
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<!--xml version="1.0" encoding="UTF-8" standalone="no"?--> < 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" > ... < build > ... < plugins > < plugin > < groupid >org.apache.maven.plugins</ groupid > < artifactid >maven-resources-plugin</ artifactid > < version >2.6</ version > </ plugin > </ plugins > ... </ build > ... </ project > |
No comments:
Post a Comment