Question 1 answer
Change:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource.class" autowire="byName">
To:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" autowire="byName">
Ie remove the .class
! :)
Question 2 answer
In your main method, you're referring to DataSource
bean by id, but the JdbcDaoImplement
bean by type. Ie you're referring to two different Spring beans. Simple update your main method as follows:
public static void main(String[] args) {
ApplicationContext ctx=new ClassPathXmlApplicationContext("spring.xml");
JdbcDaoImplement dao=ctx.getBean(JdbcDaoImplement.class);
Rect rect=dao.getRect(1);
System.out.println(rect.getName());
}