java - Run Maven webapp on server from Eclipse with properties injection from profile -


I'm Eclipse & amp; To develop the Spring + hibernate webpip, I have several profiles in my pom.xml with different properties that I inject a .properties file. This file is used in the applicationContext.xml to configure the spring, and when I want to launch the application, I am forced to deploy the template that runs outside Eclipse. Here is some part of my code:

pom.xml: ...

application.properties:

  ... # JDBC information # Some properties are my .m2 / settings. Xml jdbc.driver.classname = $ {db.driverClassName} jdbc.url = $ {db.url} / $ {db.name} $ {db.params} jdbc.user = $ {db.username} JDBC. Pass = $ {db.password} ...   

applicationContext.xml:

  ...  & Lt; Property name = "url" value = "$ {jdbc.url}" /> & Lt; Property name = "user name" value = "$ {jdbc.user}" /> & Lt; Property name = "password" value = "$ {jdbc.pass}" /> & Lt; / Bean & gt; ...   

Using the Tomcat7 Maven plugin, deployment is fine through mvn tomcat7: deployed , but when I "right-click"

  Due to: java.lang.IllegalArgumentException: 'Placeholder could not resolve db.driverClassName; As on & gt run server ", I get a lot of exceptions related to the placeholder org.springframework.util at org.springframework.util.PropertyPlaceholderHelper.parseStringValue (PropertyPlaceholderHelper.java:161) on Org.springframework .atil.PropertyPlaceholderHelper.replaceplaceholder (propertyPlaceholderHelper.java:1225) in string value "$ {db.driverClassName}" on .plertyPlaceholderHelper.parseStringValue (propertyPlaceholderHelper.java:173) org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders (orb .springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholder at (AbstractPropertyResolver.java:180) (AbstractPropertyResolver.java:145) Org.springframework.context.support.PropertyS at oursplaceholderConfigurer $ 2.resolveStringValue (propertySourcesPla CeholderConfigurer.java167) org.springframework.beans.resolveStringValue at (BeanDefinitionVisitor.java:282) org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue (BeanDefinitionVisitor.java): 204) org Org.springframework on org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition (BeanDefinitionVisitor.java:82) on .springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues ​​(BeanDefinitionVisitor.java:141) Beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties (PlaceholderConfigurerSupport.java:206) ... 17 more   

How can I run my project in the embedded logs and get logs in the console Log / Catalina Out

Thanks for the help.

found!

As I am using the Mewen Eclipse Plugin, I have a "Maven" entry (Project & gt; Properties & gt; Maven) under the A property property. I just had to activate the "Development" profile and it worked!

Project Properties

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -