V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
340244120
V2EX  ›  JetBrains

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

  •  
  •   340244120 · 2016-12-06 16:03:17 +08:00 · 4698 次点击
    这是一个创建于 2909 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 关联上我的这些配置呢?

    4 条回复    2016-12-06 17:39:58 +08:00
    echo1937
        1
    echo1937  
       2016-12-06 16:05:33 +08:00
    原来还有这个节点啊,帮你顶下以示支持。
    runcelim
        2
    runcelim  
       2016-12-06 16:24:00 +08:00
    哎,这也是我脱离 J2EE 的原因,一堆配置,身边没有老鸟,个人摸索太低效
    letitbesqzr
        3
    letitbesqzr  
       2016-12-06 17:22:39 +08:00   ❤️ 1
    340244120
        4
    340244120  
    OP
       2016-12-06 17:39:58 +08:00
    @letitbesqzr 刚刚自己琢磨着解决了,一样的步骤。不过还是十分感谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2772 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 07:49 · PVG 15:49 · LAX 23:49 · JFK 02:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.