Spring 融合 hibernate 后,如何让 intellij idea 识别相关配置呢?

2016-12-06 16:03:17 +08:00
 340244120

Spring 配置文件如下

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

	<bean id="serviceManager" class="org.springframework.context.support.ClassPathXmlApplicationContext">
		<constructor-arg>
		    <list>
		    <value>templateLayoutContext.xml</value>
		   	<value>dictionaryContext.xml</value>
			<value>dataAccessContext.xml</value>
			<value>securityContext.xml</value>
			<value>contentContext.xml</value>
			<value>scheduleContext.xml</value>
			<value>surveyContext.xml</value>
			<value>componentContext.xml</value>
			<value>videoContext.xml</value>
		    </list>
		</constructor-arg>
	</bean>

</beans>

其中 dataAccessContext.xml 是 hibernate 的一些配置。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

	<!-- ========================= GENERAL DEFINITIONS ========================= -->

	<!-- Message source for this context, loaded from localized "messages_xx" files -->
	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
		<property name="basename"><value>messages</value></property>
	</bean>

	<!-- ========================= Start of PERSISTENCE DEFINITIONS ========================= -->

	<!-- NOTE: Choose exactly 1 "dataSource" bean and 1 dialect for the "sessionFactory" -->

	<!-- Oracle JNDI DataSource for J2EE environments -->
	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiName"><value>java:comp/env/jdbc/cmsPool</value></property>
	</bean>

	<!-- Hibernate SessionFactory for Oracle -->
	<!-- for oracle 9i -->
	<!-- 
	< bean id="nativeJdbcExtractor" lazy-init="true" class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor" />
	< bean id="lobHandler" lazy-init="true"   class="org.springframework.jdbc.support.lob.OracleLobHandler">
        < property name="nativeJdbcExtractor">
            < ref bean="nativeJdbcExtractor"/>
        </property >
	</bean >
	 -->
	<!-- for other databases exception oracle 9i -->
	<bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" lazy-init="true" />
	<!-- Choose the dialect that matches your "dataSource" definition -->
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource"><ref local="dataSource"/></property>
		<property name="mappingResources">
			<value>taskjob-hbm.xml,siteMgt-hbm.xml,templateLayout-hbm.xml,sms-hbm.xml,message-hbm.xml,user-hbm.xml,schedule-hbm.xml,content-hbm.xml,log-hbm.xml,visitlog-hbm.xml,survey-hbm.xml,repository-hbm.xml,workflow-hbm.xml,component-hbm.xml,video-hbm.xml,videoRepository-hbm.xml</value>
		</property>
		<property name="hibernateProperties">
			<props>

                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
 				<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
				<prop key="hibernate.cache.use_query_cache">true</prop>
				<prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop>
		        <prop key="hibernate.show_sql">false</prop>
			</props>
		</property>
		<!-- lyg 2011-07-18 -->
		<property name="lobHandler" ref="lobHandler" />
		<!-- for oracle 9i -->
		<!--
		< property name="lobHandler">
			< ref local="lobHandler" />
		</property >
		 -->
	</bean>
...
</beans>

请问各位,我应该如何设置 idea ,才能让 idea 关联上我的这些配置呢?

4593 次点击
所在节点    JetBrains
4 条回复
echo1937
2016-12-06 16:05:33 +08:00
原来还有这个节点啊,帮你顶下以示支持。
runcelim
2016-12-06 16:24:00 +08:00
哎,这也是我脱离 J2EE 的原因,一堆配置,身边没有老鸟,个人摸索太低效
letitbesqzr
2016-12-06 17:22:39 +08:00
340244120
2016-12-06 17:39:58 +08:00
@letitbesqzr 刚刚自己琢磨着解决了,一样的步骤。不过还是十分感谢!

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/325691

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX