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

clean code #1601

Merged
merged 4 commits into from
Dec 26, 2024
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
6 changes: 3 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"component : archunit":
- changed-files:
- any-glob-to-any-file: 'boot-api-archunit-sample/**/*'
"component : choas-monkey":
"component : chaos-monkey":
- changed-files:
- any-glob-to-any-file: 'boot-choas-monkey/**/*'
- any-glob-to-any-file: 'boot-chaos-monkey/**/*'
"component : grafana-lgtm":
- changed-files:
- any-glob-to-any-file: 'boot-grafana-lgtm/**/*'
Expand Down Expand Up @@ -124,7 +124,7 @@
- any-glob-to-any-file:
- batch-boot-jpa-sample/pom.xml
- boot-api-archunit-sample/pom.xml
- boot-choas-monkey/pom.xml
- boot-chaos-monkey/pom.xml
- boot-mongodb-elasticsearch/pom.xml
- boot-opensearch-sample/pom.xml
- boot-rabbitmq-thymeleaf/pom.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: boot-choas-monkey
name: boot-chaos-monkey

on:
push:
paths:
- "boot-choas-monkey/**"
- "boot-chaos-monkey/**"
branches: [main]
pull_request:
paths:
- "boot-choas-monkey/**"
- "boot-chaos-monkey/**"
types:
- opened
- synchronize
Expand All @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: boot-choas-monkey
working-directory: boot-chaos-monkey
steps:
- uses: actions/checkout@v4
with:
Expand Down
54 changes: 27 additions & 27 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* [README](README.md)
* [Spring Batch implementation](batch-boot-jpa-sample/README.md)
* [API Example for Archunit](boot-api-archunit-sample/README.md)
* [spring-boot-choas-monkey](boot-choas-monkey/README.md)
* [spring-boot-chaos-monkey](boot-chaos-monkey/README.md)
* [Grafana LGTM Implementation](boot-grafana-lgtm/ReadMe.md)
* [MongoDb for insertion and search using elastic search](boot-mongodb-elasticsearch/README.md)
* [OpenSearch Implementation](boot-opensearch-sample/README.md)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# spring-boot-choas-monkey
# spring-boot-chaos-monkey

[Choas Monkey](https://netflix.github.io/chaosmonkey/)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions boot-choas-monkey/pom.xml → boot-chaos-monkey/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<version>3.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example.choasmonkey</groupId>
<artifactId>boot-choas-monkey</artifactId>
<groupId>com.example.chaosmonkey</groupId>
<artifactId>boot-chaos-monkey</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>boot-choas-monkey</name>
<description>Choas Engineering Principles implementation using spring boot</description>
<name>boot-chaos-monkey</name>
<description>chaos Engineering Principles implementation using spring boot</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -229,7 +229,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.22.0</version>
<version>1.25.2</version>
<style>AOSP</style>
</googleJavaFormat>
</java>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
public class ChaosMonkeyApplication {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(ChaosMonkeyApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.example.choasmonkey.common.ContainerConfig;
import org.springframework.boot.SpringApplication;

public class TestApplication {
public class TestChaosMonkeyApplication {

public static void main(String[] args) {
SpringApplication.from(Application::main).with(ContainerConfig.class).run(args);
SpringApplication.from(ChaosMonkeyApplication::main).with(ContainerConfig.class).run(args);
}
}
1 change: 0 additions & 1 deletion boot-grafana-lgtm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<!-- Remove version when spring boot supports-->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>grafana</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion boot-rabbitmq-thymeleaf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.22.0</version>
<version>1.25.2</version>
<style>AOSP</style>
</googleJavaFormat>
</java>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;

import com.poc.boot.rabbitmq.common.ContainerConfiguration;
import com.poc.boot.rabbitmq.model.Order;
import com.poc.boot.rabbitmq.repository.TrackingStateRepository;
import java.util.concurrent.TimeUnit;
Expand All @@ -20,7 +21,7 @@

@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = TestRabbitMQApplication.class)
classes = ContainerConfiguration.class)
@AutoConfigureMockMvc
class RabbitMQIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
package com.poc.boot.rabbitmq;

import com.poc.boot.rabbitmq.common.ContainerConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.devtools.restart.RestartScope;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.testcontainers.containers.RabbitMQContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
public class TestRabbitMQApplication {

@Bean
@ServiceConnection
@RestartScope
RabbitMQContainer rabbitMQContainer() {
return new RabbitMQContainer(DockerImageName.parse("rabbitmq").withTag("4.0.4-management"));
}

public static void main(String[] args) {
SpringApplication.from(RabbitMQApplication::main).with(TestRabbitMQApplication.class).run();
SpringApplication.from(RabbitMQApplication::main).with(ContainerConfiguration.class).run();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.poc.boot.rabbitmq.common;

import org.springframework.boot.devtools.restart.RestartScope;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.testcontainers.containers.RabbitMQContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
public class ContainerConfiguration {

@Bean
@ServiceConnection
@RestartScope
RabbitMQContainer rabbitMQContainer() {
return new RabbitMQContainer(DockerImageName.parse("rabbitmq").withTag("4.0.5-management"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;

@WebMvcTest(MessageController.class)
Expand All @@ -29,7 +29,7 @@ class MessageControllerTest {

@Autowired private MockMvc mockMvc;

@MockBean private OrderMessageSender orderMessageSender;
@MockitoBean private OrderMessageSender orderMessageSender;

@Test
void handleMessage() throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion boot-rest-docs-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.22.0</version>
<version>1.25.2</version>
<style>AOSP</style>
</googleJavaFormat>
<importOrder />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
public class RestDocsApplication {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(RestDocsApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.example.restdocs.common.ContainerConfig;
import org.springframework.boot.SpringApplication;

public class TestApplication {
public class TestRestDocsApplication {

public static void main(String[] args) {
SpringApplication.from(Application::main).with(ContainerConfig.class).run(args);
SpringApplication.from(RestDocsApplication::main).with(ContainerConfig.class).run(args);
}
}
2 changes: 1 addition & 1 deletion graphql/boot-graphql-webflux/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
<configuration>
<java>
<palantirJavaFormat>
<version>2.47.0</version>
<version>2.50.0</version>
</palantirJavaFormat>
<importOrder />
<removeUnusedImports />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
public class GraphQLWebFluxApplication {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(GraphQLWebFluxApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import com.example.graphql.common.ContainerConfig;
import org.springframework.boot.SpringApplication;

public class TestApplication {
public class TestGraphQLWebFluxApplication {

public static void main(String[] args) {
SpringApplication.from(Application::main).with(ContainerConfig.class).run(args);
SpringApplication.from(GraphQLWebFluxApplication::main)
.with(ContainerConfig.class)
.run(args);
}
}
4 changes: 4 additions & 0 deletions graphql/boot-graphql-webmvc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@

<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
public class HttpProxyApplication {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(HttpProxyApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.example.rest.proxy.common.ContainersConfig;
import org.springframework.boot.SpringApplication;

class TestApplication {
class TestHttpProxyApplication {

public static void main(String[] args) {
SpringApplication.from(Application::main).with(ContainersConfig.class).run(args);
SpringApplication.from(HttpProxyApplication::main).with(ContainersConfig.class).run(args);
}
}
2 changes: 1 addition & 1 deletion httpClients/boot-rest-template/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.25.0</version>
<version>1.25.2</version>
<style>AOSP</style>
</googleJavaFormat>
</java>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
public class RestTemplateApplication {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(RestTemplateApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import com.example.rest.template.common.ContainersConfig;
import org.springframework.boot.SpringApplication;

class TestApplication {
class TestRestTemplateApplication {

public static void main(String[] args) {
SpringApplication.from(Application::main).with(ContainersConfig.class).run(args);
SpringApplication.from(RestTemplateApplication::main)
.with(ContainersConfig.class)
.run(args);
}
}
15 changes: 14 additions & 1 deletion jpa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@

Java Persistence API (JPA) is a Java application programming interface specification that describes the management of relational data in applications using Java Platform, Standard Edition and Java Platform, Enterprise Edition. It provides an object-relational mapping (ORM) facility for the Java language, allowing developers to interact with databases through the use of Java objects. JPA allows developers to easily persist and query data in a database, providing a simple and standardized approach to data persistence and management.

## All Niche Thing about using JPA
## All Niche Things about using JPA

| Title | Description |
|----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Custom Sequences](./boot-data-customsequence) | <ol> Implements CustomSequence Generation like `ORD000001` </ol> <ol> Uses [Custom Repository](https://vladmihalcea.com/basejparepository-hypersistence-utils/) instead of OOTB spring data repository </ol><ol>Logging SQL Statements using `DataSourceProxy` </ol> <ol> Connections Acquiring Optimization using `LazyConnectionDataSourceProxy` </ol> |
| [Entity Auditing using envers](./boot-data-envers) | |
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add missing description for Entity Auditing

The "Entity Auditing using envers" entry lacks a description of its features and benefits. Consider adding details about:

  • What Envers provides
  • How to implement entity auditing
  • Key configuration options
  • Best practices

| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

@SpringBootApplication
@EnableConfigurationProperties({ApplicationProperties.class})
public class Application {
public class JpaEnversApplication {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
SpringApplication.run(JpaEnversApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.example.envers.common.ContainersConfig;
import org.springframework.boot.SpringApplication;

public class TestApplication {
public class TestJpaEnversApplication {

public static void main(String[] args) {
SpringApplication.from(Application::main)
SpringApplication.from(JpaEnversApplication::main)
.with(ContainersConfig.class)
.withAdditionalProfiles("local")
.run(args);
Expand Down
Loading
Loading