Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
463 views
in Technique[技术] by (71.8m points)

spring - receiving ERROR org.springframework.web.context.ContextLoader

ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring/persistence/applicationContext-persistence.xml]: Could not resolve placeholder 'hibernate.format_sql' in value "${hibernate.format_sql}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'hibernate.format_sql' in value "${hibernate.format_sql}"

please find relevant code for applicationContext-persistence.xml

`

    <!-- Specifies the default settings that are compatible with Hibernate. -->
    <bean id="hibernateJpaVendorAdapter"
        class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />

    <!-- Creates the bean that creates the JPA entity manager factory. -->
    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter" />
        <property name="packagesToScan">
            <array>
                <value>activities.data</value>
                <value>core.translation.data</value>
                <value>core.security.data</value>
                <value>core.exception.data</value>
                <value>core</value>
                <value>application.data</value>
                <value>core.datetime.data</value>
                <value>application.defaults.data</value>
            </array>
        </property>
        <property name="jpaProperties">
            <props>
                <!-- Configures the used database dialect. This allows Hibernate to 
                    create SQL that is optimized for the used database. -->
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>

                <!-- If the value of this property is true, Hibernate writes all SQL 
                    statements to the console. -->
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>

                <!-- If the value of this property is true, Hibernate will use prettyprint 
                    when it writes SQL to the console. -->
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>

                <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory
                </prop>

                <prop key="hibernate.cache.use_second_level_cache">true</prop>

                <prop key="hibernate.cache.use_query_cache">true</prop>

                <prop key="hibernate.jdbc.time_zone">${app.localTimeZone}</prop>

                <prop key="net.sf.ehcache.configurationResourceName">/EHCache.xml</prop>

            </props>
        </property>
    </bean>

'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...