|
23 | 23 |
|
24 | 24 | <properties>
|
25 | 25 | <title>MyBatis-Spring | Sample Code</title>
|
26 |
| - < author email= "[email protected]">Hunter Presnall</ author> |
27 | 26 | < author email= "[email protected]">Eduardo Macarron</ author>
|
28 |
| - < author email= "[email protected]">Nan Lei</ author> |
29 | 27 | </properties>
|
30 | 28 |
|
31 | 29 | <body>
|
|
40 | 38 | </p>
|
41 | 39 | <subsection name="Purpose">
|
42 | 40 | <p>
|
43 |
| - This new JPetStore comes with the same idea in mind than for its predecessors: <strong>keep it simple</strong>. The main purpose behind JPetStore 6 |
44 |
| - is to demonstrate that a full web application can be built with just a few classes, and what is more important, with no advanced coding |
45 |
| - skills. You just need to know plain Java and SQL. |
| 41 | + This new JPetStore comes with the same idea in mind than its predecessors: <strong>keep it simple</strong>. |
| 42 | + The purpose of JPetStore 6 is to demonstrate how to build a web application with very few classes and no advanced coding skills. |
| 43 | + You just need to know plain Java and SQL. |
46 | 44 | </p>
|
47 | 45 | <p>
|
48 |
| - The 6th version of JPetStore is the smallest one in the family. It uses just 24 java classes while keeping a good design and program structure. |
49 |
| - As we will see a bit later, you will not find JDBC code, object creation, binding code or transaction handling code. What is more |
50 |
| - impressive is that you <strong>will not even find any call to the MyBatis API</strong>. Although this sounds magical, you will see that the |
51 |
| - combination of MyBatis mappers and dependency injection lets you build applications with no dependency on MyBatis. |
| 46 | + The 6th version of JPetStore is the smallest one in the family. |
| 47 | + It uses just 24 java classes while keeping a good design and program structure. |
| 48 | + As we will see later on, you will find no code for dealing with JDBC, for creating objects or bind them or to handle transactions. |
| 49 | + What is more impressive is that you <strong>will not find any call to the MyBatis API</strong>. |
| 50 | + Although this sounds magical, you will see that the combination of MyBatis mappers and dependency injection lets you |
| 51 | + build applications without dependencies. |
52 | 52 | </p>
|
53 | 53 | </subsection>
|
54 | 54 | <subsection name="Program Structure">
|
|
173 | 173 |
|
174 | 174 | <p>
|
175 | 175 | <span class="label important">NOTE</span> Spring's component scan feature is not able to find MyBatis mappers.
|
176 |
| - A mapper is not a plain bean and Spring would not know how to instantiate it. We will need a |
177 |
| - <code>MapperScannerConfigurer</code> for that, as we will see soon. |
| 176 | + A mapper is not a plain bean and Spring would not know how to instantiate it. We will see how to search for |
| 177 | + mappers soon. |
178 | 178 | </p>
|
179 | 179 |
|
180 | 180 | <p>We will also need a <code>DataSource</code> and a <code>TransactionManager</code>. Given that this is a demo application
|
@@ -397,52 +397,32 @@ public interface OrderMapper {
|
397 | 397 | <subsection name="Running JPetStore">
|
398 | 398 | <p>You may ask. Does all this work? Yes it does! Let's run it.</p>
|
399 | 399 | <p>Let's assume you have a clean computer. These are the steps you should follow to
|
400 |
| - have the sample running on Tomcat 7 with NetBeans 7: |
| 400 | + have the sample running on Tomcat with Eclipse: |
401 | 401 | </p>
|
402 |
| - <ul> |
403 |
| - <li>Download and install NetBeans 7.x JEE version with Tomcat 7</li> |
404 |
| - <li>In NetBeans select Team/Subversion/Checkout</li> |
405 |
| - <li>Enter "http://mybatis.googlecode.com/svn" as repository URL</li> |
406 |
| - <li>Enter "sub-projects/jpetstore-6/trunk" as remote repository folder</li> |
407 |
| - <li>Enter your projects folder name, in my case "/home/eduardo/NetBeansProjects/jpetstore6"</li> |
408 |
| - <li>NetBeans will prompt "A new project was found do you want to open it". Press ok</li> |
409 |
| - <li>A new project named "JPetStore Demo 6" will be shown in NetBeans projects tab</li> |
410 |
| - <li>Right click on jpetstore project and select "Run"</li> |
411 |
| - <li>Select Tomcat 7 Server</li> |
412 |
| - <li>JPetStore home page should be shown!!</li> |
413 |
| - </ul> |
414 |
| - <p>These are the steps to run it in Eclipse. The process is a bit longer because Eclipse does not provide |
415 |
| - built-in SVN and maven support and does not provide an option to install Tomcat.</p> |
416 | 402 | <ul>
|
417 | 403 | <li>Download and install a JDK 6 or later</li>
|
418 | 404 | <li>Download and upzip Eclipse</li>
|
419 |
| - <li>Download and unzip Tomcat 7</li> |
| 405 | + <li>Download and unzip Tomcat</li> |
420 | 406 | <li>Run Eclipse</li>
|
421 |
| - <li>In eclipse, go to Help/Eclipse Marketplace</li> |
422 |
| - <li>Install m2e plugin (maven)</li> |
423 |
| - <li>Install m2e-wtp plugin (maven for wtp)</li> |
424 |
| - <li>Install subclipse plugin (subversion)</li> |
425 |
| - <li>Go to SVN tab</li> |
426 |
| - <li>In SVN add a new repository "http://mybatis.googlecode.com/svn"</li> |
427 |
| - <li>In SVN go to "sub-projects/jpetstore-6/trunk" </li> |
428 |
| - <li>Mouse right click and select "Check out", name the project as "jpetstore"</li> |
| 407 | + <li>Go to Git tab</li> |
| 408 | + <li>Clone the repo https://github.com/mybatis/jpetstore-6.git</li> |
| 409 | + <li>Select working directory, right click and select Import Projects (general)</li> |
429 | 410 | <li>Go to Java EE tab</li>
|
430 | 411 | <li>Right click on jpetstore project and select "Configure/Convert to Maven Project"</li>
|
431 | 412 | <li>Right click on jpetstore project and select "run on server"</li>
|
432 |
| - <li>Select Tomcat 7 Server and set your installation directory</li> |
| 413 | + <li>Select Tomcat Server and set your installation directory</li> |
433 | 414 | <li>JPetStore home page should be shown!!</li>
|
434 | 415 | </ul>
|
435 | 416 | <p>
|
436 | 417 | Now you are ready to play with it, experiment with your own changes or whatever you want.
|
437 | 418 | </p>
|
438 | 419 | <p>
|
439 | 420 | And remember that if you find a bug or something that is missing or can be improved (for example the missing tests!),
|
440 |
| - change it, create a diff patch file and fill an issue with it in the |
441 |
| - <a href="http://code.google.com/p/mybatis/issues/entry">tracker</a>. Thanks in advance!!! |
| 421 | + fork the repo, change it, and open a pull request. Thanks in advance!!! |
442 | 422 | </p>
|
443 | 423 | <p>
|
444 | 424 | <span class="label important">NOTE</span>
|
445 |
| - JPetStore 6 should run in any Servlet 2.5 y JSP 2.1 compliant Java server. Netbeans or Eclipse are not needed |
| 425 | + JPetStore 6 should run in any Servlet 2.5 y JSP 2.1 compliant Java server. Eclipse is not needed |
446 | 426 | either, you can run the sample from your favorite IDE or the command line.
|
447 | 427 | </p>
|
448 | 428 | </subsection>
|
|
0 commit comments