Spring4 JDBC 通过JNDI获取数据源

为什么 jndi的id属性一定要是dataSource,如果不是dataSource就报错

 <jee:jndi-lookup id="dataSource" jndi-name="jdbc/ORCL" resource-ref="true"/>

  <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource" ref="dataSource" />
  </bean>
如果将JNDI的id属性设置为datasource,将会报错:
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'helloWorld': Injection of autowired dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.it.dao.Seacher com.it.controller.HelloWorld.seacher; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seacher' defined in class path resource [springmvc.xml]: Cannot resolve reference to bean 'jdbcTemplate' while setting bean property 'jdbcTemplate'; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplate' defined in class path resource [springmvc.xml]: Error setting property values;
nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'datasource' of bean class [org.springframework.jdbc.core.JdbcTemplate]: Bean property 'datasource' is not writable or has an invalid setter method. Did you mean 'dataSource'?

这里的name一定是dataSource,ref只要和自己定义的id一样即可

图片说明

好多东西都是规定好的 。 怎么能改呢