Giter Club home page Giter Club logo

spring-boot-demos's Introduction

Spring Boot sample projects

License

The goal of the project is to show simple demos of using Spring Boot with different technologies.

The examples are limited to Maven and JVM >= 17 (Java and Kotlin). Specifically used technologies are described below in the table.

Demo Technologies Content Build status
properties java Using and override spring boot properties status
properties kotlin Using and override spring boot properties status
rest service java, rest, slice tests Implementing rest services and using mockmvc status
rest service kotlin, rest, slice tests Implementing rest services and using mockmvc status
docker java, docker Package spring boot application in docker in different ways status
postgres java, postgres, testcontainers Using spring boot and postgresql and use testcontainers for testing status
postgres kotlin, postgres, testcontainers Using spring boot and postgresql and use testcontainers for testing status
elasticsearch kotlin, elasticsearch, testcontainers Using spring boot and elasticsearch and use testcontainers for testing status
keycloak java, keycloak Using spring boot and keycloak in one docker-compose status
rabbit mq kotlin, rabbitmq, testcontainers Using spring boot and rabbit mq and use testcontainers for testing status
mongodb java, mongodb, testcontainers Using spring boot and mongodb and use testcontainers for testing status

spring-boot-demos's People

Contributors

dependabot[bot] avatar kairenken avatar larmic avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spring-boot-demos's Issues

Add Building Docker Images using Google Jib

Google provides the Tool [Jib] (https://github.com/GoogleContainerTools/jib) to create Docker Images for Java Projects.

An example can be found here

One Advantage is that the resulting images are small in size and Jib utilizes caching to make the build process fast.

One disadvantage of this tool is that it encapsulates the whole process of creating a docker image, so one cannot see the "actual" Dockerfile that was created

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update actions/checkout digest to 0ad4b8f
  • chore(deps): update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.8.1
  • chore(deps): update kotlin monorepo to v1.9.24 (org.jetbrains.kotlin:kotlin-maven-plugin, org.jetbrains.kotlin:kotlin-maven-allopen, org.jetbrains.kotlin:kotlin-maven-noarg)
  • chore(deps): update mongo docker tag to v7.0.9
  • chore(deps): update testcontainers-java monorepo to v1.19.8 (org.testcontainers:elasticsearch, org.testcontainers:testcontainers, org.testcontainers:mongodb, org.testcontainers:junit-jupiter)
  • fix(deps): update dependency com.fasterxml.jackson.module:jackson-module-kotlin to v2.17.1
  • chore(deps): update dependency maven-wrapper to v3.3.1
  • chore(deps): update postgres docker tag to v16.3
  • chore(deps): update quay.io/keycloak/keycloak docker tag to v24
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
spring-boot-keycloak/keycloak/docker-compose.yml
  • quay.io/keycloak/keycloak 22.0
spring-boot-mongodb/misc/mongodb/docker-compose.yaml
  • mongo 7.0.8
spring-boot-postgres-java/misc/postgresql/docker-compose.yml
  • postgres 16.2-alpine
spring-boot-postgres-kotlin/misc/postgresql/docker-compose.yml
  • postgres 16.2-alpine
spring-boot-rabbitmq/misc/rabbitmq/docker-compose.yml
  • rabbitmq 3-management
dockerfile
spring-boot-in-docker/src/main/docker/Dockerfile-jvm
  • eclipse-temurin 19
  • eclipse-temurin 19
spring-boot-in-docker/src/main/docker/Dockerfile-maven
  • eclipse-temurin 19
spring-boot-in-docker/src/main/docker/Dockerfile-slim
  • eclipse-temurin 19
  • eclipse-temurin 19
github-actions
.github/workflows/spring-boot-elasticsearch.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
.github/workflows/spring-boot-in-docker.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • docker/login-action v3
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • docker/login-action v3
.github/workflows/spring-boot-keycloak.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
.github/workflows/spring-boot-mongodb.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
.github/workflows/spring-boot-postgres.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
.github/workflows/spring-boot-properties.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
.github/workflows/spring-boot-rabbitmg.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
.github/workflows/spring-boot-rest-services.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v3
maven
spring-boot-elasticsearch/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • com.fasterxml.jackson.module:jackson-module-kotlin 2.17.0
  • org.testcontainers:testcontainers 1.19.7
  • org.testcontainers:elasticsearch 1.19.7
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.jetbrains.kotlin:kotlin-maven-plugin 1.9.23
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-in-docker/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • com.spotify:dockerfile-maven-plugin 1.4.13
  • com.google.cloud.tools:jib-maven-plugin 3.4.2
spring-boot-keycloak/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-mongodb/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.testcontainers:testcontainers 1.19.7
  • org.testcontainers:junit-jupiter 1.19.7
  • org.testcontainers:mongodb 1.19.7
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-postgres-java/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • org.flywaydb:flyway-core 9.22.3
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-postgres-kotlin/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • org.flywaydb:flyway-core 9.22.3
  • org.jetbrains.kotlin:kotlin-maven-plugin 1.9.23
  • org.jetbrains.kotlin:kotlin-maven-allopen 1.9.23
  • org.jetbrains.kotlin:kotlin-maven-noarg 1.9.23
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-properties-java/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-properties-kotlin/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.jetbrains.kotlin:kotlin-maven-plugin 1.9.23
  • org.jetbrains.kotlin:kotlin-maven-allopen 1.9.23
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-rabbitmq/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • com.fasterxml.jackson.module:jackson-module-kotlin 2.17.0
  • org.testcontainers:testcontainers 1.19.7
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.jetbrains.kotlinx:kotlinx-coroutines-core 1.8.0
  • org.jetbrains.kotlin:kotlin-maven-plugin 1.9.23
  • org.jetbrains.kotlin:kotlin-maven-allopen 1.9.23
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-rest-services-java/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
spring-boot-rest-services-kotlin/pom.xml
  • org.springframework.boot:spring-boot-starter-parent 3.1.5
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.jetbrains.kotlin:kotlin-maven-plugin 1.9.23
  • org.apache.maven.plugins:maven-surefire-plugin 3.2.5
  • org.apache.maven.plugins:maven-failsafe-plugin 3.2.5
maven-wrapper
spring-boot-in-docker/.mvn/wrapper/maven-wrapper.properties
  • maven 3.9.6
  • maven-wrapper 3.2.0

  • Check this box to trigger a request for Renovate to run again on this repository

[postgres] switch to slice tests

i.e.

@Transactional(propagation = Propagation.NEVER)
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@ContextConfiguration(initializers = PostgresContextInitializer.class)
public abstract class AbstractDatabaseTest {
}

Preparation for spring with lambda

https://github.com/larmic/spring-boot-demos/blob/c54d9e717cd64f8d3470f2f79a4a4c77ad4a1b72/spring-boot-keycloak/src/main/java/de/larmic/keycloak/service1/security/KeycloakSecurityConfig.java#L43C1-L56C29

nothing wrong just updated you code for lambda, maybe its not perfect way

import static org.springframework.security.config.Customizer.withDefaults;

@Value("${spring.security.oauth2.client.registration.keycloak.client-id}")
private String clientId;

@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {

    http.authorizeHttpRequests(it -> it
                    .requestMatchers("/unsecure/*").permitAll()
                    .requestMatchers("/secure/*").hasAnyRole("admin", "custom_realm_role"))
            .csrf(AbstractHttpConfigurer::disable);

    http.oauth2Login(withDefaults())
            .logout(logout -> logout.logoutSuccessUrl("/"));
    http.oauth2ResourceServer(oauth -> oauth
            .jwt(jwtConfigurer -> jwtConfigurer
                    .jwtAuthenticationConverter(
                            jwtAuthenticationConverter(new KeycloakGrantedAuthoritiesConverter(clientId))
                    )
            )
    );

    return http.build();
}

keycloakSecurityConfig

โ”Œโ”€โ”€->โ”€โ”€โ”
| keycloakSecurityConfig (field private org.keycloak.adapters.KeycloakConfigResolver org.keycloak.adapters.springsecurity.config.KeycloakWebSecurityConfigurerAdapter.keycloakConfigResolver)
โ””โ”€โ”€<-โ”€โ”€โ”˜

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.