Stage 5 3. Micro Services [online] _day01 learn to build a development environment CMS server-side development _21- page tracking -Dao- paging query test


The static data into call Service. The final service to be called dao query data
to define dao interface

is now operating CmsPage to the following set of data. So named for CmsPageRepository. In front of the name of the model class + Repository





which provides many methods

Test dao

New packet corresponding to the program and at test.



Write test cases via annotations.
Because the addition of annotations @SpringbootTest, so the package will go below to find SpringBoot start classes.

When you find the startup class. Start class notes there are many scan package. He scans the Bean developed under the package added to the Spring container.

Then we can take this CmsPageRepository Bean from the container
write a test findAll way

into the break. Queries to record.

Test paging query.
Paging method requires parameters the Pageable

the Pageable Do not choose the wrong package name.




Get the data


Guess you like

Origin www.cnblogs.com/wangjunwei/p/11543249.html