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

java 17 & boot #64

Merged
merged 3 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
3 changes: 3 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "Mono",
"image": "mcr.microsoft.com/devcontainers/universal:focal",
"postAttachCommand": "source ./init.sh",
"containerEnv": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the magic that defaults us to using 17 instead of 11 🤦

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in what world would I ever think that DISABLE_JAVA_BUILD => Java 17 wild

"DISABLE_JAVA_BUILD": "true"
},
"customizations": {
"vscode": {
"settings": {
Expand Down
37 changes: 37 additions & 0 deletions java-spring-boot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
10 changes: 10 additions & 0 deletions java-spring-boot/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
init:
gradle build

verify:
gradle test

run:
gradle bootRun

.PHONY: init verify run
36 changes: 36 additions & 0 deletions java-spring-boot/build.gradle
kylehoehns marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.4'
id 'io.spring.dependency-management' version '1.1.3'
}

group = 'com.sourceallies'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
useJUnitPlatform()
}
1 change: 1 addition & 0 deletions java-spring-boot/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'interview'
Binary file added java-spring-boot/src/.DS_Store
kylehoehns marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.sourceallies.interview;

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

@SpringBootApplication
public class InterviewApplication {

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.sourceallies.interview;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Solution {

@GetMapping
public String getGreeting() {
return "Hello, world!";
}
}
6 changes: 6 additions & 0 deletions java-spring-boot/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring:
autoconfigure:
exclude:
# Remove these exclusions if you'd like to use JPA for database functionality
- org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
- org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.sourceallies.interview;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class InterviewApplicationTests {

@Test
void contextLoads() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.sourceallies.interview;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

public class SolutionTest {

@Test
void shouldSayHelloWorld() {
var solution = new Solution();
assertEquals("Hello, world!", solution.getGreeting());
}


}
6 changes: 3 additions & 3 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<groupId>com.sourceallies</groupId>
<artifactId>interview</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Interview Problem Template with Maven Build</name>
<description>Interview Problem Template with Maven Build</description>
<name>Interview Problem</name>
<description>Interview Problem with Maven</description>
<properties>
<java.version>11</java.version>
<java.version>17</java.version>
<maven-surefire-plugin.version>3.0.0-M6</maven-surefire-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down