Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue with Spring profiles and my properties files
    primarykey
    data
    text
    <p>I am trying <strong>to activate one set of properties files for one Spring profile</strong> and another set for another Spring profile as follows:</p> <pre><code>&lt;beans profile="cloud"&gt; &lt;context:property-placeholder location="classpath*:META-INF/spring/cloud/*.properties" /&gt; &lt;/beans&gt; &lt;beans profile="default"&gt; &lt;context:property-placeholder location="classpath*:META-INF/spring/default/*.properties" /&gt; &lt;/beans&gt; </code></pre> <p>I have the corresponding and appropriate directory structure in my <code>src/main/resources</code> folder.</p> <p>I have a simple <code>@Value("${application.url}")</code> in one of my services and I systematically get the following error:</p> <blockquote> <p>Error creating bean with name 'mailerServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.Be anCreationException: Could not autowire field: private java.lang.String com.kadjoukor.service.MailerServiceImpl.websiteContext; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'application.url' in string value "${application.url}"</p> </blockquote> <p>Note that I have tried adding a <code>spring.profiles.active</code> <code>init-param</code> to my web.xml. It doesn't make any difference...</p> <p>I am not sure what I am getting wrong. Can anyone please provide advice?</p> <p><strong>EDIT 1</strong>: Could it matter that the above snippets of configuration are <strong>located at the bottom of the configuration file</strong>?</p> <p><strong>EDIT 2</strong>: Here is the output of my <code>web.xml</code>:</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" standalone="no"?&gt; &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="true"&gt; &lt;display-name&gt;kadjoukor&lt;/display-name&gt; &lt;description&gt;Roo generated kadjoukor application&lt;/description&gt; &lt;!-- Enable escaping of form submission contents --&gt; &lt;context-param&gt; &lt;param-name&gt;defaultHtmlEscape&lt;/param-name&gt; &lt;param-value&gt;true&lt;/param-value&gt; &lt;/context-param&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;classpath*:META-INF/spring/applicationContext*.xml classpath:META-INF/cloud/cloudfoundry-auto-reconfiguration-context.xml&lt;/param-value&gt;&lt;/context-param&gt; &lt;filter&gt; &lt;filter-name&gt;CharacterEncodingFilter&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt; &lt;init-param&gt; &lt;param-name&gt;encoding&lt;/param-name&gt; &lt;param-value&gt;UTF-8&lt;/param-value&gt; &lt;/init-param&gt; &lt;init-param&gt; &lt;param-name&gt;forceEncoding&lt;/param-name&gt; &lt;param-value&gt;true&lt;/param-value&gt; &lt;/init-param&gt; &lt;/filter&gt; &lt;filter&gt; &lt;filter-name&gt;HttpMethodFilter&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.HiddenHttpMethodFilter&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter&gt; &lt;filter-name&gt;Spring OpenEntityManagerInViewFilter&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;CharacterEncodingFilter&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;HttpMethodFilter&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;Spring OpenEntityManagerInViewFilter&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;!-- Creates the Spring Container shared by all Servlets and Filters --&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;listener&gt; &lt;listener-class&gt; org.springframework.security.web.session.HttpSessionEventPublisher &lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Handles Spring requests --&gt; &lt;servlet&gt; &lt;servlet-name&gt;kadjoukor&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;WEB-INF/spring/webmvc-config.xml classpath:META-INF/cloud/cloudfoundry-auto-reconfiguration-context.xml&lt;/param-value&gt;&lt;/init-param&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;kadjoukor&lt;/servlet-name&gt; &lt;url-pattern&gt;/&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;session-config&gt; &lt;session-timeout&gt;30&lt;/session-timeout&gt;&lt;!-- TODO --&gt; &lt;/session-config&gt; &lt;context-param&gt;&lt;param-name&gt;contextInitializerClasses&lt;/param-name&gt;&lt;param-value&gt;org.cloudfoundry.reconfiguration.spring.CloudApplicationContextInitializer&lt;/param-value&gt;&lt;/context-param&gt;&lt;/web-app&gt; </code></pre> <p>and here is the contents of the <code>WEB-INF/libs</code> directory:</p> <pre><code>activation-1.1.1.jar 67.8K antlr-2.7.6.jar 433.0K aopalliance-1.0.jar 4.4K asm-3.3.1.jar 42.6K aspectjrt-1.7.0.RC1.jar 113.5K aspectjweaver-1.7.0.RC1.jar 1.7M auto-reconfiguration-0.6.5.jar 693.3K cglib-2.2.2.jar 280.5K cglib-nodep-2.2.2.jar 319.3K commons-beanutils-1.8.3.jar 226.6K commons-codec-1.5.jar 71.4K commons-collections-3.2.1.jar 561.9K commons-dbcp-1.3.jar 145.3K commons-digester-2.1.jar 192.2K commons-fileupload-1.2.2.jar 58.2K commons-io-2.1.jar 159.3K commons-lang3-3.1.jar 308.4K commons-logging-1.0.4.jar 37.1K commons-pool-1.5.6.jar 98.1K dom4j-1.6.1.jar 306.5K ehcache-core-2.6.0.jar 1.3M flexjson-2.1.jar 79.2K guava-11.0.2.jar 1.6M hamcrest-core-1.1.jar 74.8K hibernate-commons-annotations-3.2.0.Final.jar 69.6K hibernate-core-3.6.9.Final.jar 3.0M hibernate-entitymanager-3.6.9.Final.jar 416.3K hibernate-jpa-2.0-api-1.0.1.Final.jar 100.3K hibernate-validator-4.2.0.Final.jar 358.0K httpclient-4.1.2.jar 344.0K httpcore-4.1.2.jar 177.0K imgscalr-lib-4.2.jar 27.2K jackson-core-asl-1.9.9.jar 226.7K jackson-mapper-asl-1.9.9.jar 762.0K java-xmlbuilder-0.4.jar 18.1K javassist-3.12.0.GA.jar 618.5K javassist-3.16.1-GA.jar 643.9K javax.inject-1.jar 2.4K jcl-over-slf4j-1.6.4.jar 16.9K jets3t-0.9.0.jar 527.1K jmimemagic-0.1.2.jar 44.5K joda-time-2.1.jar 557.1K jsr305-1.3.9.jar 32.2K jstl-api-1.2.jar 29.8K jstl-impl-1.2.jar 382.8K jta-1.1.jar 14.7K junit-dep-4.8.2.jar 213.2K log4j-1.2.16.jar 470.2K mail-1.4.3.jar 451.3K mysema-commons-lang-0.2.4.jar 11.8K mysql-connector-java-5.1.18.jar 771.4K ognl-3.0.5.jar 222.5K oro-2.0.8.jar 63.7K prettytime-1.0.8.Final.jar 65.4K querydsl-core-2.9.0.jar 367.3K querydsl-jpa-2.9.0.jar 93.3K slf4j-api-1.6.4.jar 25.4K slf4j-log4j12-1.6.4.jar 9.5K spring-aop-3.2.0.RELEASE.jar 327.0K spring-aspects-3.2.0.RELEASE.jar 68.2K spring-beans-3.2.0.RELEASE.jar 590.6K spring-context-3.2.0.RELEASE.jar 834.0K spring-context-support-3.2.0.RELEASE.jar 124.1K spring-core-3.2.0.RELEASE.jar 842.8K spring-data-commons-core-1.3.0.RELEASE.jar 215.0K spring-data-jpa-1.1.0.RELEASE.jar 129.8K spring-expression-3.2.0.RELEASE.jar 189.2K spring-jdbc-3.2.0.RELEASE.jar 391.6K spring-js-resources-2.2.1.RELEASE.jar 4.3M spring-orm-3.2.0.RELEASE.jar 383.0K spring-security-acl-3.1.2.RELEASE.jar 77.7K spring-security-config-3.1.2.RELEASE.jar 198.9K spring-security-core-3.1.2.RELEASE.jar 332.1K spring-security-taglibs-3.1.2.RELEASE.jar 20.3K spring-security-web-3.1.2.RELEASE.jar 245.2K spring-social-core-1.0.2.RELEASE.jar 113.7K spring-social-facebook-1.0.2.RELEASE.jar 117.2K spring-social-web-1.0.2.RELEASE.jar 18.0K spring-tx-3.2.0.RELEASE.jar 235.3K spring-web-3.2.0.RELEASE.jar 609.7K spring-webmvc-3.2.0.RELEASE.jar 621.0K thymeleaf-2.0.14.jar 677.9K thymeleaf-extras-tiles2-1.0.0-beta3-SNAPSHOT.jar 46.7K thymeleaf-spring3-2.0.14.jar 161.9K tiles-api-2.2.2.jar 35.1K tiles-core-2.2.2.jar 157.2K tiles-jsp-2.2.2.jar 49.6K tiles-servlet-2.2.2.jar 58.3K tiles-template-2.2.2.jar 23.9K validation-api-1.0.0.GA.jar 46.3K xercesImpl-2.7.1.jar 1.1M xml-apis-1.0.b2.jar 106.8K xmlParserAPIs-2.0.2.jar 76.6K </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload