开发者

Annotation based ApplicationContext

I understand that the ApplicationContext can be annotation based in Spring 3.

Can anybody please share an example , so that I could refer the same.

Thanks in advance, Vivek

EDIT - This is the XML configuration:

<context:annotation-config /> <context:component-scan base-package="com.test" /> <mvc:annotation-driven /> <bean id="dataSource" destroy-method="close" class=org.apache.commons.dbcp.BasicDataSource "> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/test" /> <property name="username" value="test" /> <property name="password" value="test" /> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> </bean> <bean id="mapper" class="org.mybatis.spring.mapper.MapperFactoryBean"> <property name="mapperInterface" value="com.test.Mapper" /> <prope开发者_如何学Pythonrty name="sqlSessionFactory" ref="sqlSessionFactory" /> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <bean id="dao" class="com.test.MapperDao"> <property name="mapper" ref="mapper" /> </bean> <bean id="Controller" class="com.test.Controller" />


I have been through the Spring 3 Documentation and understood the @Configuration annotation. So issue resolved :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜