github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/docs/examples/example_osv_java_servlet/readme.md (about) 1 # Spring PetClinic Sample Application [![Build Status](https://travis-ci.org/spring-projects/spring-petclinic.png?branch=master)](https://travis-ci.org/spring-projects/spring-petclinic/) 2 3 ## Understanding the Spring Petclinic application with a few diagrams 4 <a href="https://speakerdeck.com/michaelisvy/spring-petclinic-sample-application">See the presentation here</a> 5 6 ## Running petclinic locally 7 ``` 8 git clone https://github.com/spring-projects/spring-petclinic.git 9 cd spring-petclinic 10 ./mvnw tomcat7:run 11 ``` 12 13 You can then access petclinic here: http://localhost:9966/petclinic/ 14 15 ## In case you find a bug/suggested improvement for Spring Petclinic 16 Our issue tracker is available here: https://github.com/spring-projects/spring-petclinic/issues 17 18 19 ## Database configuration 20 21 In its default configuration, Petclinic uses an in-memory database (HSQLDB) which 22 gets populated at startup with data. A similar setup is provided for MySql in case a persistent database configuration is needed. 23 Note that whenever the database type is changed, the data-access.properties file needs to be updated and the mysql-connector-java artifact from the pom.xml needs to be uncommented. 24 25 You may start a MySql database with docker: 26 27 ``` 28 docker run -e MYSQL_ROOT_PASSWORD=petclinic -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8 29 ``` 30 31 ## Working with Petclinic in Eclipse/STS 32 33 ### prerequisites 34 The following items should be installed in your system: 35 * Maven 3 (http://www.sonatype.com/books/mvnref-book/reference/installation.html) 36 * git command line tool (https://help.github.com/articles/set-up-git) 37 * Eclipse with the m2e plugin (m2e is installed by default when using the STS (http://www.springsource.org/sts) distribution of Eclipse) 38 39 Note: when m2e is available, there is an m2 icon in Help -> About dialog. 40 If m2e is not there, just follow the install process here: http://eclipse.org/m2e/download/ 41 42 43 ### Steps: 44 45 1) In the command line 46 ``` 47 git clone https://github.com/spring-projects/spring-petclinic.git 48 ``` 49 2) Inside Eclipse 50 ``` 51 File -> Import -> Maven -> Existing Maven project 52 ``` 53 54 55 ## Looking for something in particular? 56 57 <table> 58 <tr> 59 <th width="300px">Java Config</th><th width="300px"></th> 60 </tr> 61 <tr> 62 <td>Java Config branch</td> 63 <td> 64 Petclinic uses XML configuration by default. In case you'd like to use Java Config instead, there is a Java Config branch available <a href="https://github.com/spring-projects/spring-petclinic/tree/javaconfig">here</a>. Thanks to Antoine Rey for his contribution. 65 </td> 66 </tr> 67 <tr> 68 <th width="300px">Inside the 'Web' layer</th><th width="300px">Files</th> 69 </tr> 70 <tr> 71 <td>Spring MVC - XML integration</td> 72 <td><a href="/src/main/resources/spring/mvc-view-config.xml">mvc-view-config.xml</a></td> 73 </tr> 74 <tr> 75 <td>Spring MVC - ContentNegotiatingViewResolver</td> 76 <td><a href="/src/main/resources/spring/mvc-view-config.xml">mvc-view-config.xml</a></td> 77 </tr> 78 <tr> 79 <td>JSP custom tags</td> 80 <td> 81 <a href="/src/main/webapp/WEB-INF/tags">WEB-INF/tags</a> 82 <a href="/src/main/webapp/WEB-INF/jsp/owners/createOrUpdateOwnerForm.jsp">createOrUpdateOwnerForm.jsp</a></td> 83 </tr> 84 <tr> 85 <td>Bower</td> 86 <td> 87 <a href="/pom.xml">bower-install maven profile declaration inside pom.xml</a> <br /> 88 <a href="/bower.json">JavaScript libraries are defined by the manifest file bower.json</a> <br /> 89 <a href="/.bowerrc">Bower configuration using JSON</a> <br /> 90 <a href="/src/main/resources/spring/mvc-core-config.xml#L30">Resource mapping in Spring configuration</a> <br /> 91 <a href="/src/main/webapp/WEB-INF/jsp/fragments/staticFiles.jsp#L12">sample usage in JSP</a></td> 92 </td> 93 </tr> 94 <tr> 95 <td>Dandelion-datatables</td> 96 <td> 97 <a href="/src/main/webapp/WEB-INF/jsp/owners/ownersList.jsp">ownersList.jsp</a> 98 <a href="/src/main/webapp/WEB-INF/jsp/vets/vetList.jsp">vetList.jsp</a> 99 <a href="/src/main/webapp/WEB-INF/web.xml">web.xml</a> 100 <a href="/src/main/resources/dandelion/datatables/datatables.properties">datatables.properties</a> 101 </td> 102 </tr> 103 <tr> 104 <td>Thymeleaf branch</td> 105 <td> 106 <a href="http://www.thymeleaf.org/petclinic.html">See here</a></td> 107 </tr> 108 <tr> 109 <td>Branch using GemFire and Spring Data GemFire instead of ehcache (thanks Bijoy Choudhury)</td> 110 <td> 111 <a href="https://github.com/bijoych/spring-petclinic-gemfire">See here</a></td> 112 </tr> 113 </table> 114 115 <table> 116 <tr> 117 <th width="300px">'Service' and 'Repository' layers</th><th width="300px">Files</th> 118 </tr> 119 <tr> 120 <td>Transactions</td> 121 <td> 122 <a href="/src/main/resources/spring/business-config.xml">business-config.xml</a> 123 <a href="/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java">ClinicServiceImpl.java</a> 124 </td> 125 </tr> 126 <tr> 127 <td>Cache</td> 128 <td> 129 <a href="/src/main/resources/spring/tools-config.xml">tools-config.xml</a> 130 <a href="/src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java">ClinicServiceImpl.java</a> 131 </td> 132 </tr> 133 <tr> 134 <td>Bean Profiles</td> 135 <td> 136 <a href="/src/main/resources/spring/business-config.xml">business-config.xml</a> 137 <a href="/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceJdbcTests.java">ClinicServiceJdbcTests.java</a> 138 <a href="/src/main/webapp/WEB-INF/web.xml">web.xml</a> 139 </td> 140 </tr> 141 <tr> 142 <td>JdbcTemplate</td> 143 <td> 144 <a href="/src/main/resources/spring/business-config.xml">business-config.xml</a> 145 <a href="/src/main/java/org/springframework/samples/petclinic/repository/jdbc">jdbc folder</a></td> 146 </tr> 147 <tr> 148 <td>JPA</td> 149 <td> 150 <a href="/src/main/resources/spring/business-config.xml">business-config.xml</a> 151 <a href="/src/main/java/org/springframework/samples/petclinic/repository/jpa">jpa folder</a></td> 152 </tr> 153 <tr> 154 <td>Spring Data JPA</td> 155 <td> 156 <a href="/src/main/resources/spring/business-config.xml">business-config.xml</a> 157 <a href="/src/main/java/org/springframework/samples/petclinic/repository/springdatajpa">springdatajpa folder</a></td> 158 </tr> 159 </table> 160 161 <table> 162 <tr> 163 <th width="300px">Others</th><th width="300px">Files</th> 164 </tr> 165 <tr> 166 <td>Gradle branch</td> 167 <td> 168 <a href="https://github.com/whimet/spring-petclinic">See here</a></td> 169 </tr> 170 </table> 171 172 173 ## Interaction with other open source projects 174 175 One of the best parts about working on the Spring Petclinic application is that we have the opportunity to work in direct contact with many Open Source projects. We found some bugs/suggested improvements on various topics such as Spring, Spring Data, Bean Validation and even Eclipse! In many cases, they've been fixed/implemented in just a few days. 176 Here is a list of them: 177 178 <table> 179 <tr> 180 <th width="300px">Name</th> 181 <th width="300px"> Issue </th> 182 </tr> 183 184 <tr> 185 <td>Spring JDBC: simplify usage of NamedParameterJdbcTemplate</td> 186 <td> <a href="https://jira.springsource.org/browse/SPR-10256"> SPR-10256</a> and <a href="https://jira.springsource.org/browse/SPR-10257"> SPR-10257</a> </td> 187 </tr> 188 <tr> 189 <td>Bean Validation / Hibernate Validator: simplify Maven dependencies and backward compatibility</td> 190 <td> 191 <a href="https://hibernate.atlassian.net/browse/HV-790"> HV-790</a> and <a href="https://hibernate.atlassian.net/browse/HV-792"> HV-792</a> 192 </td> 193 </tr> 194 <tr> 195 <td>Spring Data: provide more flexibility when working with JPQL queries</td> 196 <td> 197 <a href="https://jira.springsource.org/browse/DATAJPA-292"> DATAJPA-292</a> 198 </td> 199 </tr> 200 <tr> 201 <td>Eclipse: validation bug when working with .tag/.tagx files (has only been fixed for Eclipse 4.3 (Kepler)). <a href="https://github.com/spring-projects/spring-petclinic/issues/14">See here for more details.</a></td> 202 <td> 203 <a href="https://issuetracker.springsource.com/browse/STS-3294"> STS-3294</a> 204 </td> 205 </tr> 206 </table> 207 208 209 # Contributing 210 211 The [issue tracker](https://github.com/spring-projects/spring-petclinic/issues) is the preferred channel for bug reports, features requests and submitting pull requests. 212 213 For pull requests, editor preferences are available in the [editor config](https://github.com/spring-projects/spring-petclinic/blob/master/.editorconfig) for easy use in common text editors. Read more and download plugins at <http://editorconfig.org>. 214 215 216 217