META-INF.spring.mailbox-jpa.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- Mailbox JPA --> <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/> <bean id="jpa-mailboxIdFactory" class="org.apache.james.mailbox.jpa.JPAId.Factory" /> <bean id="jpa-mailboxmanager" class="org.apache.james.mailbox.jpa.openjpa.OpenJPAMailboxManager"> <constructor-arg index="0" ref="jpa-sessionMapperFactory"/> <constructor-arg index="1" ref="sessionProvider"/> <constructor-arg index="2" ref="messageParser"/> <constructor-arg index="3" ref="messageIdFactory" /> <constructor-arg index="4" ref="event-bus" /> <constructor-arg index="5" ref="storeMailboxAnnotationManager" /> <constructor-arg index="6" ref="storeRightManager" /> <constructor-arg index="7" ref="quotaComponents" /> <constructor-arg index="8" ref="indexer" /> <constructor-arg index="9" ref="threadIdGuessingAlgorithm" /> <constructor-arg index="10" ref="clock" /> </bean> <bean id="threadIdGuessingAlgorithm" class="org.apache.james.mailbox.store.mail.NaiveThreadIdGuessingAlgorithm" /> <bean id="clock" class="java.time.Clock" factory-method="systemUTC" /> <bean id ="jpa-subscriptionManager" class="org.apache.james.mailbox.store.StoreSubscriptionManager"> <constructor-arg index="0" ref="jpa-sessionMapperFactory"/> <constructor-arg index="1" ref="jpa-sessionMapperFactory"/> <constructor-arg index="2" ref="event-bus"/> </bean> <bean id="jpa-sessionMapperFactory" class="org.apache.james.mailbox.jpa.JPAMailboxSessionMapperFactory"> <constructor-arg index="0" ref="entityManagerFactory"/> <constructor-arg index="1" ref="jpa-uidProvider"/> <constructor-arg index="2" ref="jpa-modSeqProvider"/> </bean> <bean id="jpa-uidProvider" class="org.apache.james.mailbox.jpa.mail.JPAUidProvider"> <constructor-arg index="0" ref="entityManagerFactory"/> </bean> <bean id="jpa-modSeqProvider" class="org.apache.james.mailbox.jpa.mail.JPAModSeqProvider"> <constructor-arg index="0" ref="entityManagerFactory"/> </bean> <!-- Database DataSource --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders" value="true"/> <property name ="location" value="classpath:james-database.properties"/> </bean> <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${database.driverClassName}" /> <property name="url" value="${database.url}" /> <property name="username" value="${database.username}" /> <property name="password" value="${database.password}" /> <property name="testOnBorrow" value="${datasource.testOnBorrow:false}" /> <property name="validationQueryTimeout" value="${datasource.validationQueryTimeoutSec:-1}" /> <property name="validationQuery" value="${datasource.validationQuery:#{null}}" /> </bean> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="datasource"/> <property name="jpaVendorAdapter" ref="vendorAdapter"/> <property name="persistenceUnitName" value="James"/> </bean> <bean id="vendorAdapter" class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter"> <property name="database" value="${vendorAdapter.database}"/> <!-- set this to true for debugging purposes --> <property name="showSql" value="false"/> </bean> <bean id="jpa-per-user-max-quota-dao" class="org.apache.james.mailbox.jpa.quota.JPAPerUserMaxQuotaDAO"> <constructor-arg index="0" ref="entityManagerFactory"/> </bean> <bean id="jpaMaxQuotaManager" class="org.apache.james.mailbox.jpa.quota.JPAPerUserMaxQuotaManager"> <constructor-arg index="0" ref="entityManagerFactory"/> <constructor-arg index="1" ref="jpa-per-user-max-quota-dao"/> </bean> <bean id="jpaCurrentQuotaManager" class="org.apache.james.mailbox.jpa.quota.JpaCurrentQuotaManager"> <constructor-arg index="0" ref="entityManagerFactory"/> </bean> </beans>