spring learn experience

本文介绍了Spring框架的配置方式及依赖注入的多种实现方法,包括普通实例化、静态工厂实例化和工厂实例化等,并探讨了注解自动扫描、反射与内省的区别以及双重检查锁定模式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • org.springframework.context-3.1.0.M2.jar
  • org.springframework.beans-3.1.0.M2.jar
  • dist\org.springframework.core-3.1.0.M2.jar
  • commons-logging-1.1.1.jar
  • dist\org.springframework.asm-3.1.0.M2.jar
  • dist\org.springframework.expression-3.1.0.M2.jar
  • commons-beanutils-1.8.0.jar
  • dom4j

  • Introspector   java.beans.Introspector

http://www.kaifa6.com/v/J2SEApi/javaref/jdkref/java.beans.introspector_dsc.htm#getBeanInfo(java.lang.Class, java.lang.Class)


  • ConvertUtils.convert("1232a", Integer.class);    org.apache.commons.beanutils.ConvertUtils
<?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-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context-3.0.xsd
           ">

<!-- for annotation should quote the three line above and a line below -->
	<context:annotation-config/>

<!-- id can not been named as special character ,but name does -->
<!-- 1. normal instance of bean-->
  <bean id="personService" class="beans.PersonServiceBean">
  	<property name="personDao" ref="personDao"></property>
  	<property name="testName" value="James"/>
  	<property name="sets">
  		<set>
  			<value>a</value>
  			<value>b</value>
  			<value>c</value>
  		</set>
  	</property>
  	<property name="lists">
  		<list>
  			<value>a</value>
  			<value>b</value>
  			<value>c</value>
  			<bean class="interfaces.PersonServiceFactory" />
  			<bean class="beans.PersonDaoBean"/>
  		</list>
  	</property>
  	
  	<property name="maps">  
  		<map>
  			<entry key="3" value="personDao"/>
		    <entry key="1" value-ref="personDao"/>
		    <entry key="2" value-ref="personDao"/>
	   </map>
  		
  	</property>
  	<property name="properties">
  		<props>
  			<prop key="age">11</prop>
  		</props>
  	</property>
  </bean>
  <bean id="personDao" class="beans.PersonDaoBean">
  </bean>
	
<!-- 2. static factory instance of bean-->
  <bean id="personService2" class="interfaces.PersonServiceFactory" factory-method="createFactory"/>
  
<!-- 3. factory instance of bean-->
  <bean id="personServiceFactory" class="interfaces.PersonServiceFactory"/>
  <bean id="personService3" factory-bean="personServiceFactory" factory-method="createFactory2"/>
<!--   <bean id="personService3" factory-bean="personServiceFactory" factory-method="createFactory2" scope="prototype"/> -->
</beans>

  <?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-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context-3.0.xsd
           ">
<!-- FOR AUTO INJECT IN CLASS FILES -->
	  <context:component-scan base-package="beans"/>
</beans>
 

 

 

 

  • differences between Reflect and Introspector

 

 

 

  • Automatically detecting classes and registering bean definitions

@Service @Repository @Controller
@Scope .....

 

 

 

double checked lock 

http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

 

 

 

### Spring AI Advisor Resources and Guidance For individuals seeking guidance within the context of Spring AI, it is important to understand that while specific details about Spring AI's advisory structure are not directly provided in the references given, general principles from academic advising can offer valuable insights. A competent advisor works closely with mentees to establish priorities and achieve a balanced approach towards various professional activities such as conducting research, engaging in continuous learning through reading and writing, fulfilling teaching assistant (TA) or research assistant (RA) responsibilities, pursuing publication opportunities, and completing course work[^1]. When considering technical roles like those mentioned for Senior Solutions Architects at companies like Amazon, having a background in computer science or mathematics becomes crucial due to the necessity of understanding software development practices and internet-related technologies[^2]. Similarly, candidates aiming to engage effectively with an organization focused on artificial intelligence would benefit greatly from possessing relevant educational credentials along with practical experience, especially concerning mobile applications development[^3]. To apply these guidelines specifically toward obtaining effective mentorship related to Spring AI: - Seek out mentors who have expertise both in artificial intelligence fields and also possess strong backgrounds either academically or professionally aligned with your interests. - Engage actively by setting clear goals regarding what you wish to learn or accomplish during this period under advisement. - Leverage available resources including workshops, seminars, online courses offered by institutions specializing in AI technology. ```python # Example Python code snippet demonstrating how one might implement machine learning algorithms using Scikit-Learn library which could be part of spring ai projects from sklearn import datasets iris = datasets.load_iris() X, y = iris.data, iris.target print(X.shape) ``` --related questions-- 1. What types of qualifications should someone look for when choosing an AI-focused mentor? 2. How does gaining industry-specific skills impact finding suitable guidance in specialized areas like AI? 3. Can participating in community events help connect aspiring professionals with experienced advisors in emerging tech sectors?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值