Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull from fork #4

Merged
merged 31 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ce7c3f9
Upgrade to Spring Boot 2.2.0.RELEASE
snicoll Oct 20, 2019
ac69dbb
Migrate tests to JUnit 5
arey Oct 10, 2018
253e6fd
Polish "Migrate tests to JUnit 5"
snicoll Oct 20, 2019
6e4c31c
Merge pull request #360 from arey
snicoll Oct 20, 2019
32301ed
Fix compatibility with Java 13
snicoll Oct 31, 2019
d47820b
Update to Spring Boot 2.2.1
dsyer Nov 20, 2019
2c98a68
Uncomment sql initialization for mysql
dsyer Nov 20, 2019
1561eb5
Add proxyBeanMethods = false
dsyer Nov 20, 2019
f9424b5
Spring Boot 2.2.2
dsyer Dec 10, 2019
5d57e0d
Re-organise mysql scripts so the app runs without root access
dsyer Jan 3, 2020
82cb521
Fix MySQL docker command line in readme
dsyer Jan 3, 2020
4e1f874
Apply spring-format plugin
dsyer Jan 3, 2020
108a81b
Upgrade to Spring Boot 2.2.4
snicoll Jan 25, 2020
9387366
Upgrade to spring javaformat 0.0.19
snicoll Jan 25, 2020
5742ecd
Use https for Maven XSD
Jan 31, 2020
400e302
Polish "Use https for Maven XSD"
snicoll Jan 31, 2020
7e64f55
Merge pull request #522 from vbadipat
snicoll Jan 31, 2020
1cc942a
Add nohttp check
snicoll Jan 31, 2020
ac3e642
Update checkstyle plugin for security scan warning
dsyer Feb 3, 2020
5c35771
Wrong name for user.sql script
dsyer Mar 10, 2020
e0eec8e
Add m2e profile for well-known plugins
snicoll Mar 20, 2020
a79cb9a
Upgrade to Spring Boot 2.2.5
snicoll Mar 20, 2020
e624588
Upgrade to spring javaformat 0.0.20
snicoll Mar 20, 2020
c0847b7
Add support for H2
snicoll Mar 20, 2020
8805eaa
Disable open-in-view explicitly to remove warning on startup
snicoll Mar 20, 2020
8db8c27
Fix typo in readme
jelliotartz Mar 29, 2020
56f0933
Merge pull request #586 from jelliotartz
snicoll Mar 30, 2020
d9f37ec
Upgrade to Spring Boot 2.3.0.RC1
snicoll May 2, 2020
6288622
Switch actuator to standard path
snicoll May 2, 2020
6a18eec
Upgrade to spring javaformat 0.0.21
snicoll May 3, 2020
adab01e
Upgrade to maven checkstyle plugin 3.1.1
snicoll May 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0'
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ mysql:
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=petclinic
- MYSQL_ROOT_PASSWORD=
- MYSQL_ALLOW_EMPTY_PASSWORD=true
- MYSQL_USER=petclinic
- MYSQL_PASSWORD=petclinic
- MYSQL_DATABASE=petclinic
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"
2 changes: 1 addition & 1 deletion mvnw
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0'
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
Expand Down
2 changes: 1 addition & 1 deletion mvnw.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM https://www.apache.org/licenses/LICENSE-2.0'
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
Expand Down
143 changes: 135 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.3.0.BUILD-SNAPSHOT</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.9.RELEASE</version>
<version>2.3.0.RC1</version>
</parent>
<name>petclinic</name>

Expand All @@ -27,8 +27,9 @@
<webjars-jquery.version>2.2.4</webjars-jquery.version>
<wro4j.version>1.8.0</wro4j.version>

<jacoco.version>0.8.2</jacoco.version>

<jacoco.version>0.8.5</jacoco.version>
<nohttp-checkstyle.version>0.0.4.RELEASE</nohttp-checkstyle.version>
<spring-format.version>0.0.21</spring-format.version>
</properties>

<dependencies>
Expand All @@ -49,6 +50,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
Expand All @@ -57,12 +62,18 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Databases - Uses HSQL by default -->
<!-- Databases - Uses H2 by default -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -103,6 +114,18 @@
</dependency>
<!-- end of webjars -->

<!-- Testing -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
Expand All @@ -112,6 +135,54 @@

<build>
<plugins>
<plugin>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
<version>${spring-format.version}</version>
<!-- run ./mvnw spring-javaformat:apply to apply -->
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.29</version>
</dependency>
<dependency>
<groupId>io.spring.nohttp</groupId>
<artifactId>nohttp-checkstyle</artifactId>
<version>${nohttp-checkstyle.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>nohttp-checkstyle-validation</id>
<phase>validate</phase>
<configuration>
<configLocation>src/checkstyle/nohttp-checkstyle.xml</configLocation>
<suppressionsLocation>src/checkstyle/nohttp-checkstyle-suppressions.xml</suppressionsLocation>
<encoding>UTF-8</encoding>
<sourceDirectories>${basedir}</sourceDirectories>
<includes>**/*</includes>
<excludes>**/.git/**/*,**/.idea/**/*,**/target/**/,**/.flattened-pom.xml,**/*.class</excludes>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand Down Expand Up @@ -256,4 +327,60 @@
</pluginRepository>
</pluginRepositories>

<profiles>
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<!-- This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<versionRange>[1,)</versionRange>
<goals>
<goal>check</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<versionRange>[1,)</versionRange>
<goals>
<goal>build-info</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>

</project>
9 changes: 6 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ Our issue tracker is available here: https://github.com/spring-projects/spring-p

## Database configuration

In its default configuration, Petclinic uses an in-memory database (HSQLDB) which
gets populated at startup with data. A similar setup is provided for MySql in case a persistent database configuration is needed.
In its default configuration, Petclinic uses an in-memory database (H2) which
gets populated at startup with data. The h2 console is automatically exposed at `http://localhost:8080/h2-console`
and it is possible to inspect the content of the database using the `jdbc:h2:mem:testdb` url.

A similar setup is provided for MySql in case a persistent database configuration is needed.
Note that whenever the database type is changed, the app needs to be run with a different profile: `spring.profiles.active=mysql` for MySql.

You could start MySql locally with whatever installer works for your OS, or with docker:

```
docker run -e MYSQL_ROOT_PASSWORD=petclinic -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8
docker run -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8
```

Further documentation is provided [here](https://github.com/spring-projects/spring-petclinic/blob/master/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt).
Expand Down
8 changes: 8 additions & 0 deletions src/checkstyle/nohttp-checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files="[\\/]build.log" checks="NoHttp"/>
<suppress files=".+\.(jar|git|ico|p12|gif|jks|jpg|svg)" checks="NoHttp"/>
</suppressions>
7 changes: 7 additions & 0 deletions src/checkstyle/nohttp-checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"https://checkstyle.org/dtds/configuration_1_2.dtd">
<module name="com.puppycrawl.tools.checkstyle.Checker">
<module name="io.spring.nohttp.checkstyle.check.NoHttpCheck"/>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
* @author Dave Syer
*
*/
@SpringBootApplication
@SpringBootApplication(proxyBeanMethods = false)
public class PetClinicApplication {

public static void main(String[] args) {
SpringApplication.run(PetClinicApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(PetClinicApplication.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,21 @@
*/
@MappedSuperclass
public class BaseEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

public Integer getId() {
return id;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}

public boolean isNew() {
return this.id == null;
}
public void setId(Integer id) {
this.id = id;
}

public boolean isNew() {
return this.id == null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,30 @@
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;


/**
* Simple JavaBean domain object adds a name property to <code>BaseEntity</code>. Used as a base class for objects
* needing these properties.
* Simple JavaBean domain object adds a name property to <code>BaseEntity</code>. Used as
* a base class for objects needing these properties.
*
* @author Ken Krebs
* @author Juergen Hoeller
*/
@MappedSuperclass
public class NamedEntity extends BaseEntity {

@Column(name = "name")
private String name;
@Column(name = "name")
private String name;

public String getName() {
return this.name;
}
public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}

@Override
public String toString() {
return this.getName();
}
@Override
public String toString() {
return this.getName();
}

}
Loading