Could not resolve placeholder ' spring.security.mapping.directory ' in string value ' ${spring.security

Source: Internet
Author: User

1. Error description

2015-09-20 22:30:25 [main] WARN Org.springframework.context.support.genericapplicationcontext-exception encountered During context initialization-cancelling Refresh Attemptorg.springframework.beans.factory.BeanDefinitionStoreException:Invalid Bean definition with name ' Sessionfactory ' defined in class path resource [Applicationcontext.xml]: Could not resolve placeholder ' SPRING.SECURITY.M Apping.directory ' in string value ' ${spring.security.mapping.directory} '; Nested exception is java.lang.IllegalArgumentException:Could not resolve placeholder ' Spring.security.mapping.directory ' in string value ' ${spring.security.mapping.directory} ' at Org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties ( placeholderconfigurersupport.java:211) at Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties ( propertyplaceholderconfigurer.java:223) at Org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactoRy (propertyresourceconfigurer.java:86) at Org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors ( postprocessorregistrationdelegate.java:265) at Org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors ( postprocessorregistrationdelegate.java:162) at Org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors ( abstractapplicationcontext.java:606) at Org.springframework.context.support.AbstractApplicationContext.refresh ( abstractapplicationcontext.java:462) at Org.springframework.test.context.support.AbstractGenericContextLoader.loadContext ( abstractgenericcontextloader.java:125) at Org.springframework.test.context.support.AbstractGenericContextLoader.loadContext ( ABSTRACTGENERICCONTEXTLOADER.JAVA:60) at Org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading ( abstractdelegatingsmartcontextloader.java:108) at Org.springframework.test.contexT.support.abstractdelegatingsmartcontextloader.loadcontext (abstractdelegatingsmartcontextloader.java:260) at Org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContextInternal ( DEFAULTCACHEAWARECONTEXTLOADERDELEGATE.JAVA:63) at Org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext ( defaultcacheawarecontextloaderdelegate.java:83) at Org.springframework.test.context.DefaultTestContext.getApplicationContext (defaulttestcontext.java:74) at Org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies ( dependencyinjectiontestexecutionlistener.java:116) at Org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance ( dependencyinjectiontestexecutionlistener.java:82) at Org.springframework.test.context.TestContextManager.prepareTestInstance (testcontextmanager.java:212) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest (Springjunit4classrunner.java:199) at Org.springframework.test.context.junit4.springjunit4classrunner$1.runreflectivecall ( springjunit4classrunner.java:251) at Org.junit.internal.runners.model.ReflectiveCallable.run ( REFLECTIVECALLABLE.JAVA:12) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock ( springjunit4classrunner.java:253) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild ( springjunit4classrunner.java:216) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild ( springjunit4classrunner.java:82) at Org.junit.runners.parentrunner$3.run (parentrunner.java:290) at Org.junit.runners.parentrunner$1.schedule (parentrunner.java:71) at Org.junit.runners.ParentRunner.runChildren ( parentrunner.java:288) at org.junit.runners.parentrunner.access$000 (parentrunner.java:58) at Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:268) at Org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate ( RUNBEFORETESTCLASSCALLBACKS.JAVA:60) at Org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate ( runaftertestclasscallbacks.java:67) at Org.junit.runners.ParentRunner.run (parentrunner.java:363) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run (springjunit4classrunner.java:162) at Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUNIT4TESTREFERENCE.JAVA:50) at Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197) caused by: Java.lang.IllegalArgumentException:Could not resolve placeholder ' spring.security.mapping.directory ' in string value " ${spring.security.mapping.directory} "at Org.sPringframework.util.PropertyPlaceholderHelper.parseStringValue (propertyplaceholderhelper.java:174) at Org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders (propertyplaceholderhelper.java:126) at org.springframework.beans.factory.config.propertyplaceholderconfigurer$ Placeholderresolvingstringvalueresolver.resolvestringvalue (propertyplaceholderconfigurer.java:259) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue (Beandefinitionvisitor.java : 282) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue (Beandefinitionvisitor.java : 204) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.visitList (beandefinitionvisitor.java:228 ) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue (beandefinitionvisitor.java:192) At Org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues ( beandefinitionvisitor.java:141) at Org.springframework.beans.factory.config.BeanDefinitionVisItor.visitbeandefinition (beandefinitionvisitor.java:82) at Org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties ( placeholderconfigurersupport.java:208) ... PNS more2015-09-20 22:30:25 [main] ERROR Org.springframework.test.context.testcontextmanager-caught exception while Allowing Testexecutionlistener [ORG.SPRINGFRAMEWOR[EMAIL PROTECTED]6C9F45F4] to prepare test instance [email  protected]]java.lang.illegalstateexception:failed to load Applicationcontextat Org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext ( defaultcacheawarecontextloaderdelegate.java:91) at Org.springframework.test.context.DefaultTestContext.getApplicationContext (defaulttestcontext.java:74) at Org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies ( dependencyinjectiontestexecutionlistener.java:116) at Org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(dependencyinjectiontestexecutionlistener.java:82) at Org.springframework.test.context.TestContextManager.prepareTestInstance (testcontextmanager.java:212) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest (springjunit4classrunner.java:199) at Org.springframework.test.context.junit4.springjunit4classrunner$1.runreflectivecall ( springjunit4classrunner.java:251) at Org.junit.internal.runners.model.ReflectiveCallable.run ( REFLECTIVECALLABLE.JAVA:12) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock ( springjunit4classrunner.java:253) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild ( springjunit4classrunner.java:216) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild ( springjunit4classrunner.java:82) at Org.junit.runners.parentrunner$3.run (parentrunner.java:290) at Org.junit.runners.parentrunner$1.schedule (parentrunner.java:71) at Org.junit.runners.ParentRunner.runChildren ( parentrunner.java:288) at org.junit.runners.parentrunner.access$000 (parentrunner.java:58) at Org.junit.runners.parentrunner$2.evaluate ( parentrunner.java:268) at Org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate ( RUNBEFORETESTCLASSCALLBACKS.JAVA:60) at Org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate ( runaftertestclasscallbacks.java:67) at Org.junit.runners.ParentRunner.run (parentrunner.java:363) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run (springjunit4classrunner.java:162) at Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUNIT4TESTREFERENCE.JAVA:50) at Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:467) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:683) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:390) at Org.Eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:197) caused by: Org.springframework.beans.factory.BeanDefinitionStoreException:Invalid Bean definition with name ' sessionfactory ' Defined in class path resource [Applicationcontext.xml]: Could not resolve placeholder ' Spring.security.mapping.directory ' in string value ' ${spring.security.mapping.directory} '; Nested exception is java.lang.IllegalArgumentException:Could not resolve placeholder ' Spring.security.mapping.directory ' in string value ' ${spring.security.mapping.directory} ' at Org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties ( placeholderconfigurersupport.java:211) at Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties ( propertyplaceholderconfigurer.java:223) at Org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory ( propertyresourceconfigurer.java:86) at Org.springframework.context.support.PostProCessorregistrationdelegate.invokebeanfactorypostprocessors (postprocessorregistrationdelegate.java:265) at Org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors ( postprocessorregistrationdelegate.java:162) at Org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors ( abstractapplicationcontext.java:606) at Org.springframework.context.support.AbstractApplicationContext.refresh ( abstractapplicationcontext.java:462) at Org.springframework.test.context.support.AbstractGenericContextLoader.loadContext ( abstractgenericcontextloader.java:125) at Org.springframework.test.context.support.AbstractGenericContextLoader.loadContext ( ABSTRACTGENERICCONTEXTLOADER.JAVA:60) at Org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading ( abstractdelegatingsmartcontextloader.java:108) at Org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext ( Abstractdelegatingsmartcontextloader.java:260) at Org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContextInternal ( DEFAULTCACHEAWARECONTEXTLOADERDELEGATE.JAVA:63) at Org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext ( defaultcacheawarecontextloaderdelegate.java:83) ... morecaused by:java.lang.IllegalArgumentException:Could not resolve placeholder ' spring.security.mapping.directory ' In string value ' ${spring.security.mapping.directory} ' at Org.springframework.util.PropertyPlaceholderHelper.parseStringValue (propertyplaceholderhelper.java:174) at Org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders (propertyplaceholderhelper.java:126) at org.springframework.beans.factory.config.propertyplaceholderconfigurer$ Placeholderresolvingstringvalueresolver.resolvestringvalue (propertyplaceholderconfigurer.java:259) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue (Beandefinitionvisitor.java : 282) at Org.springframework. Beans.factory.config.BeanDefinitionVisitor.resolveValue (beandefinitionvisitor.java:204) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.visitList (beandefinitionvisitor.java:228) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue (beandefinitionvisitor.java:192) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues (Beandefinitionvisitor.java : 141) at Org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition ( beandefinitionvisitor.java:82) at Org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties ( placeholderconfigurersupport.java:208) ... Panax Notoginseng More

2. Cause of error

Because spring.security is not used in the project and the relevant jar is not imported, this is configured to cause an error


3. Solutions

Applicationcontext.xml Remove:

<value>${spring.security.mapping.directory}</value>


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Could not resolve placeholder ' spring.security.mapping.directory ' in string value ' ${spring.security

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.