Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnandrews committed Jan 21, 2024
0 parents commit a2d2d9f
Show file tree
Hide file tree
Showing 21 changed files with 681 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*
replay_pid*

##############################
## Maven
##############################
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
pom.xml.bak
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

##############################
## Gradle
##############################
bin/
build/
.gradle
.gradletasknamecache
gradle-app.setting
!gradle-wrapper.jar

##############################
## IntelliJ
##############################
out/
.idea/
.idea_modules/
*.iml
*.ipr
*.iws

##############################
## Eclipse
##############################
.settings/
#bin/
tmp/
.metadata
.classpath
.project
*.tmp
*.bak
*.swp
*~.nib
local.properties
.loadpath
.factorypath

##############################
## NetBeans
##############################
nbproject/private/
#build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

##############################
## Visual Studio Code
##############################
.vscode/
.code-workspace

##############################
## OS X
##############################
.DS_Store

##############################
## Credit
##############################
# File sourced from https://gist.github.com/dedunumax/54e82214715e35439227
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Quinn Andrews

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Spring Local – Example
117 changes: 117 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.quinnandrews</groupId>
<artifactId>spring-local-example</artifactId>
<version>1.0.0-SNAPSHOT</version>

<name>Spring Local - Example</name>
<description>
Example project demonstrating the use of Spring Local modules
in a Spring Boot Application to support both integration testing
and local development.
</description>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.2.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</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-web</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>io.github.quinnandrews</groupId>
<artifactId>spring-data-specification-builder</artifactId>
<version>1.0.0</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.quinnandrews</groupId>
<artifactId>spring-local-postgresql</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>6.3.1.Final</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package io.github.quinnandrews.spring.local.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package io.github.quinnandrews.spring.local.example.data.guitarpedals;

import jakarta.persistence.*;

import java.time.LocalDate;
import java.util.List;

@Table(name = "guitar_pedal")
@Entity
public class GuitarPedal {

@Id
@Column(name = "id",
columnDefinition = "BIGINT",
nullable = false,
updatable = false)
private Long id;

@Column(name = "name",
columnDefinition = "VARCHAR(64)",
nullable = false)
private String name;

@Column(name = "has_stereo_output",
columnDefinition = "BOOLEAN",
nullable = false)
private Boolean hasStereoOutput;

@Column(name = "date_purchased",
columnDefinition = "DATE",
nullable = false)
private LocalDate datePurchased;

@Column(name = "date_sold",
columnDefinition = "DATE")
private LocalDate dateSold;

@Column(name = "used_value",
columnDefinition = "INT",
nullable = false)
private Integer usedValue;

@ManyToOne
@JoinColumn(name="manufacturer_id",
nullable=false,
updatable=false)
private Manufacturer manufacturer;

@OneToMany
@JoinColumn(name="guitar_pedal_id")
private List<GuitarPedalTag> tags;

public GuitarPedal() {
// no-op
}

public Long getId() {
return id;
}

public String getName() {
return name;
}

public Boolean getHasStereoOutput() {
return hasStereoOutput;
}

public LocalDate getDatePurchased() {
return datePurchased;
}

public LocalDate getDateSold() {
return dateSold;
}

public Integer getUsedValue() {
return usedValue;
}

public Manufacturer getManufacturer() {
return manufacturer;
}

public List<GuitarPedalTag> getTags() {
return tags;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.github.quinnandrews.spring.local.example.data.guitarpedals;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Table(name = "guitar_pedal_tag")
@Entity
public class GuitarPedalTag {

@Id
@Column(name = "id",
columnDefinition = "BIGINT",
nullable = false,
updatable = false)
private Long id;

@Column(name = "tag",
columnDefinition = "VARCHAR(16)",
nullable = false)
private String tag;

public GuitarPedalTag() {
// no-op
}

public Long getId() {
return id;
}

public String getTag() {
return tag;
}
}
Loading

0 comments on commit a2d2d9f

Please sign in to comment.