spring 프로필 상세 설명
                                            
 85770 단어  beanxml라벨ssh 프레임 워 크Spring 설정 해석
                    
<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	                   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	                   http://www.springframework.org/schema/context
	                   http://www.springframework.org/schema/context/spring-context-2.5.xsd
	                   ">
<context:component-scan base-package="com.persia">
<!--        -->
</context:component-scan>
<context:annotation-config>
<!--       -->
</context:annotation-config>
<!--     ,   propertity xml  ,  xml     -->
<bean id="personServiceAnno" class="com.persia.PersonServiceAnnotation"></bean>
<bean id="personDaoBeanAnno" class="com.persia.PersonDaoBean"></bean>
<bean id="personDaoBeanAnno2" class="com.persia.PersonDaoBean"></bean>
<!--      -->
<bean id="personServiceAutoInject" class="com.persia.PersonServiceAutoInject" autowire="byName"></bean>
<bean id="personService" class="com.persia.PersonServiceBean">
<!--  spring        ,           -->
</bean>
<bean id="personService2" class="com.persia.PersonServiceBeanFactory" factory-method="createInstance" lazy-init="true" 
      init-method="init"  destroy-method="destory">
<!--       bean -->
</bean>
<bean id="fac" class="com.persia.PersonServiceBeanInsFactory"></bean>
<bean id="personService3" factory-bean="fac" factory-method="createInstance" scope="prototype">
<!--       bean,          bean-->
</bean>
<!-- ref       -->
<bean id="personDao" class="com.persia.PersonDaoBean"></bean>
<bean id="personService4" class="com.persia.PersonServiceBean">
  <property name="personDao" ref="personDao"></property>
</bean>
<!--   bean     -->
<bean id="personService5" class="com.persia.PersonServiceBean">
  <property name="personDao">
     <bean class="com.persia.PersonDaoBean"></bean>
  </property>
  <property name="name" value="persia"></property>
  <property name="age" value="21"></property>
  
  <property name="sets">
    <!--       -->
     <set>
       <value>   </value>
       <value>   </value>
       <value>   </value>
     </set>
  </property>
  
  <property name="lists">
    <!--       -->
    <list>
        <value>   l</value>
       <value>   l</value>
       <value>   l</value>
    </list>
    
  </property>
  
  <property name="properties">
    <props>
      <prop key="key1">value1</prop>
      <prop key="key2">value2</prop>
      <prop key="key3">value3</prop>
    </props>
  </property>
  
  <property name="map">
   <map>
      <entry key="key1" value="value-1"></entry>
      <entry key="key2" value="value-2"></entry>
      <entry key="key3" value="value-3"></entry>
   </map>
  </property>
</bean>
<bean id="personService6" class="com.persia.PersonServiceBean">
   <constructor-arg index="0" value="     name" ></constructor-arg>
   <!--         type -->
   <constructor-arg index="1" type="com.persia.IDaoBean" ref="personDao">
   </constructor-arg> 
</bean>
</beans>2. AOP 오픈:
<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	                   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	                    http://www.springframework.org/schema/aop
	                   http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
	                   http://www.springframework.org/schema/context
	                   http://www.springframework.org/schema/context/spring-context-2.5.xsd
	                  ">
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
<bean id="myInterceptor" class="com.persia.service.MyInterceptor"></bean>
<bean id="personServiceImpl" class="com.persia.service.impl.PersonServiceImpl"></bean>
</beans>AOP xml  <?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	                   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	                    http://www.springframework.org/schema/aop
	                   http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
	                   http://www.springframework.org/schema/context
	                   http://www.springframework.org/schema/context/spring-context-2.5.xsd
	                  ">
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
<bean id="personService" class="com.persia.service.impl.PersonServiceImpl"></bean>
<bean id="aspectBean" class="com.persia.service.MyInterceptor"></bean>
<aop:config>
 <aop:aspect id="myaop" ref="aspectBean">
 <aop:pointcut id="mycut" expression="execution(* com.persia.service.impl.PersonServiceImpl.*(..))"/>
 <aop:pointcut id="argcut" expression="execution(* com.persia.service.impl.PersonServiceImpl.*(..)) and args(name)"/>  
 <aop:before pointcut-ref="mycut" method="doAccessCheck"  />
 <aop:after-returning pointcut-ref="mycut" method="doAfterReturning"/>
   <aop:after-throwing pointcut-ref="mycut" method="doThrowing"/>
   <aop:after pointcut-ref="argcut" method="doAfter" arg-names="name"/>
 <aop:around pointcut-ref="mycut" method="arround"/>
 </aop:aspect>
  
</aop:config>
</beans>3.       :<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" 
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	                   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	                   http://www.springframework.org/schema/context
	                   http://www.springframework.org/schema/context/spring-context-2.5.xsd
	                   http://www.springframework.org/schema/aop
	                   http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
	                   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
	                  ">
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
	                  
<!--       -->   
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">   
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>   
    <property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8"/>   
    <property name="username" value="root"/>   
    <property name="password" value=""/>   
     <!--            -->   
     <property name="initialSize" value="1"/>   
     <!--         -->   
     <property name="maxActive" value="500"/>   
     <!--      .          ,                       ,     maxIdle   -->   
     <property name="maxIdle" value="2"/>   
     <!--       .            ,             ,            -->   
     <property name="minIdle" value="1"/>   
  </bean>  
   
  <!--        -->   
 <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">   
    <property name="dataSource" ref="dataSource"/>   
  </bean>  
  <!--     bean -->
    <bean id="personService" class="com.persia.service.impl.PersonServiceImpl">
    <property name="ds" ref="dataSource"></property>
  </bean>
   
  <!--   @Transactional          -->   
  <tx:annotation-driven transaction-manager="txManager"/>  
</beans>XML 버 전:
<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" 
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	                   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	                   http://www.springframework.org/schema/context
	                   http://www.springframework.org/schema/context/spring-context-2.5.xsd
	                   http://www.springframework.org/schema/aop
	                   http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
	                   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
	                  ">
<aop:aspectj-autoproxy></aop:aspectj-autoproxy>
	                  
<!--       -->   
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">   
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>   
    <property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8"/>   
    <property name="username" value="root"/>   
    <property name="password" value=""/>   
     <!--            -->   
     <property name="initialSize" value="1"/>   
     <!--         -->   
     <property name="maxActive" value="500"/>   
     <!--      .          ,                       ,     maxIdle   -->   
     <property name="maxIdle" value="2"/>   
     <!--       .            ,             ,            -->   
     <property name="minIdle" value="1"/>   
  </bean>  
   
<!--         -->
 <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">   
    <property name="dataSource" ref="dataSource"/>   
  </bean>  
  <!--     bean -->
   <bean id="personService" class="com.persia.service.impl.PersonServiceImpl">
    <property name="ds" ref="dataSource"></property>
  </bean>
  
  
    <!--   XML       -->  
<aop:config>  
    <!--       ,           -->   
    <aop:pointcut id="transactionPointcut" expression="execution(* com.persia.service..*.*(..))"/>  
    <aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut"/>  
</aop:config> 
<!--          -->    
<tx:advice id="txAdvice" transaction-manager="txManager">  
      <tx:attributes> 
      <!--    get   ,      --> 
        <tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED"/> 
      <!--             --> 
        <tx:method name="*"/>  
      </tx:attributes>  
</tx:advice>  
   
  
</beans>4.SSH:
<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" 
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	                   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	                   http://www.springframework.org/schema/context
	                   http://www.springframework.org/schema/context/spring-context-2.5.xsd
	                   http://www.springframework.org/schema/aop
	                   http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
	                   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
	                  ">
	<!--       -->   
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">   
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>   
    <property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8"/>   
    <property name="username" value="root"/>   
    <property name="password" value=""/>   
     <!--            -->   
     <property name="initialSize" value="1"/>   
     <!--         -->   
     <property name="maxActive" value="500"/>   
     <!--      .          ,                       ,     maxIdle   -->   
     <property name="maxIdle" value="2"/>   
     <!--       .            ,             ,            -->   
     <property name="minIdle" value="1"/>   
  </bean>  
  
  <!--   hibernate sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
	<property name="dataSource"><ref bean="dataSource" /></property>
	 <property name="mappingResources">
		    <list>
		      <value>com/persia/model/Person.hbm.xml</value>
		    </list>
		 </property>
		 
	    <!-- 1.   sessionFactory      3    -->
        <!-- 2.             ehcache.xml        -->
        <!-- 3.           bean              -->
             <!--      --> 
             <!--        ,          --> 
             <!--   Ehcache     -->  
	 <property name="hibernateProperties">
		    <value>
		        hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
		        hibernate.hbm2ddl.auto=update
		        hibernate.show_sql=false
		        hibernate.format_sql=false
		        hibernate.cache.use_second_level_cache=true
       	        hibernate.cache.use_query_cache=false
        	    hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
		    </value>
	     </property>
</bean>
<!--   Spring  hibernate       -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
	  	<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--                -->	
<tx:annotation-driven transaction-manager="txManager"/>
<!--               bean -->
<context:annotation-config></context:annotation-config>
<!--        bean -->
<bean id="personService" class="com.persia.service.impl.PersonServiceImpl"></bean>
<!-- Struts action  Spring      -->
<bean name="/person/list" class="com.persia.struts.PersonListAction">
<!--1.    name struts-config   action path    ,  id        -->
<!--2.   Struts-config      Spring      ,       action path   Spring        bean,        bean        -->
<!--3.    action type    (  ), Spring       bean ,    Struts action-->
<!--4.   action    Spring          bean-->
</bean>
<bean name="/person/manage" class="com.persia.struts.PersonManageAction"></bean>
</beans>5.SSH2:
<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" 
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	                   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	                   http://www.springframework.org/schema/context
	                   http://www.springframework.org/schema/context/spring-context-2.5.xsd
	                   http://www.springframework.org/schema/aop
	                   http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
	                   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
	                  ">
	<!--       -->   
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">   
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>   
    <property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8"/>   
    <property name="username" value="root"/>   
    <property name="password" value=""/>   
     <!--            -->   
     <property name="initialSize" value="1"/>   
     <!--         -->   
     <property name="maxActive" value="500"/>   
     <!--      .          ,                       ,     maxIdle   -->   
     <property name="maxIdle" value="2"/>   
     <!--       .            ,             ,            -->   
     <property name="minIdle" value="1"/>   
  </bean>  
  
  <!--   hibernate sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
	<property name="dataSource"><ref bean="dataSource" /></property>
	 <property name="mappingResources">
		    <list>
		      <value>com/persia/model/Person.hbm.xml</value>
		    </list>
		 </property>
		 
	    <!-- 1.   sessionFactory      3    -->
        <!-- 2.             ehcache.xml        -->
        <!-- 3.           bean              -->
             <!--      --> 
             <!--        ,          --> 
             <!--   Ehcache     -->  
	 <property name="hibernateProperties">
		    <value>
		        hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
		        hibernate.hbm2ddl.auto=update
		        hibernate.show_sql=false
		        hibernate.format_sql=false
		        hibernate.cache.use_second_level_cache=true
       	        hibernate.cache.use_query_cache=false
        	    hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
		    </value>
	     </property>
</bean>
<!--   Spring  hibernate       -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
	  	<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--                -->	
<tx:annotation-driven transaction-manager="txManager"/>
<!--               bean -->
<context:annotation-config></context:annotation-config>
<!--        bean -->
<bean id="personService" class="com.persia.service.impl.PersonServiceImpl"></bean>
<!--  Struts 2 action -->
<bean id="personList" class="com.persia.struts2.action.PersonListAction"></bean>
</beans>6.SSJ:
<?xml version="1.0" encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" 
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	                   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	                   http://www.springframework.org/schema/context
	                   http://www.springframework.org/schema/context/spring-context-2.5.xsd
	                   http://www.springframework.org/schema/aop
	                   http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
	                   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
	                  ">
<!--               bean -->
<context:annotation-config></context:annotation-config>
<!-- 1.  Spring  JPA -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
      <property name="persistenceUnitName" value="SpringJPAPU"/>
</bean>
<!--2.  Spring  JPA    -->
    <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  	  <property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<!--3.       -->
<tx:annotation-driven transaction-manager="txManager"/>
  
<!--  3 Spring  JPA   , web     Spring  ,   JPA         -->
<!--     bean -->
<bean id="personService" class="com.persia.service.impl.PersonServiceImpl"></bean>
<!--   Struts action -->
<bean name="/person/list" class="com.persia.struts.PersonListAction"/>
<bean name="/person/manage" class="com.persia.struts.PersonManageAction"/>
</beans>이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
DI & IoC & Bean객체를 직접 생성하는 게 아니라 외부에서 생성한 후 주입 시켜주는 방식이다. 첫번째 방법은 A객체가 B와 C 객체를 New 생성자를 통해 직접 생성하는 방법이고, 두번째 방법은 외부에서 생성된 객체를 setter()...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.