When Ibatis encountered Spring

xiaoxiao2021-03-06  61

With more than knowing, Spring gave people a surprise, and initially learned about the integration development of the two, the main information is the Spring documentation of Xia Rong and Spring official example. JPETSTORE. Put your experience here.

From the architecture, Spring is undoubtedly located in a high level as a lightweight IOC container, so IBATI now only needs to work to complete the SQL-Object mapping of the persistence layer, and other things are assembled by spring.

The first is to connect the pool, and you can configure a DataSource-bean for use in Spring, a lot of ready-made wheels.

Two major tasks made by Daomanager in iBatis: DAO transaction management, DAO interface and implementation, this is the strength of Spring, and Spring transaction processing uses AOP, which can be configured to configure the method level (support regular expression), specify Which categories require transaction processing, whether you are DAO or service, you can freely assign it here, you don't invade you, if you are ejb, you will force you to implement the EJB interface specified in the container. .

As for cache this wheel, iBatis makes good, we use it. In ibatis, cachemodelsenabled is True by default, don't forget to work on the Caching Configuration when writing specific pojo.xml.

转载请注明原文地址:https://www.9cbs.com/read-82251.html

New Post(0)