Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

## Modules 🗂️
- **[spring-core-lab](spring-core-lab): Spring Core 🌱**
- **[spring-web-lab](spring-web-lab): Spring Web 🌐**
- **[spring-data-jpa-lab](spring-data-jpa-lab): Spring Data JPA 💾**
- **[spring-security-lab](spring-security-lab): Spring Security 🔐**

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<module>spring-core-lab</module>
<module>spring-data-jpa-lab</module>
<module>spring-security-lab</module>
<module>spring-web-lab</module>
</modules>

<properties>
Expand Down
5 changes: 5 additions & 0 deletions spring-web-lab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Spring Web Lab 🌐

## Sources 🔗

* [Java Senior Quiz 🧩](https://youtube.com/playlist?list=PLO5muTI694A5yRrEDNY1czqEUVbYHG_AH&si=KteWFowVcOSTQ8F-)
35 changes: 35 additions & 0 deletions spring-web-lab/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>pl.mperor.lab.spring</groupId>
<artifactId>spring-lab</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>spring-web-lab</artifactId>

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

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package pl.mperor.lab.spring;

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

@SpringBootApplication
public class SpringWebLabApplication {

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

}
9 changes: 9 additions & 0 deletions spring-web-lab/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#management:
# endpoints:
# web:
# exposure:
# include: "*"

#logging:
# level:
# org.springframework.boot.actuate: DEBUG
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package pl.mperor.lab.spring;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.test.web.reactive.server.WebTestClient;

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureWebTestClient
public class SpringWebLabApplicationTest {

@Autowired
private WebTestClient client;

@Test
public void contextLoads() {
}

@Test
public void shouldReturnHealthStatusUp() {
client.get().uri("/actuator/health")
.exchange()
.expectStatus().isEqualTo(HttpStatus.OK)
.expectBody()
.jsonPath("$.status").isEqualTo("UP");
}

}
Loading