The following was discovered as part of building this project:
- The original package name 'com.programandoenjava.java-bot' is invalid and this project uses 'com.programandoenjava.java_bot' instead.
For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- GraalVM Native Image Support
- Spring Boot Testcontainers support
- Testcontainers Postgres Module Reference Guide
- OpenAI
- Spring Web
- Docker Compose Support
- Spring Security
- Spring Data JPA
- Validation
- Testcontainers
The following guides illustrate how to use some features concretely:
- Building a RESTful Web Service
- Serving Web Content with Spring MVC
- Building REST services with Spring
- Securing a Web Application
- Spring Boot and OAuth2
- Authenticating a User with LDAP
- Accessing Data with JPA
- Validation
These additional references should also help you:
This project contains a Docker Compose file named compose.yaml.
In this file, the following services have been defined:
- postgres:
postgres:latest
Please review the tags of the used images and set them to the same as you're running in production.
This project has been configured to let you generate either a lightweight container or a native executable. It is also possible to run your tests in a native image.
If you're already familiar with Spring Boot container images support, this is the easiest way to get started. Docker should be installed and configured on your machine prior to creating the image.
To create the image, run the following goal:
$ ./mvnw spring-boot:build-image -Pnative
Then, you can run the app like any other container:
$ docker run --rm -p 8080:8080 java-bot:0.0.1-SNAPSHOT
Use this option if you want to explore more options such as running your tests in a native image.
The GraalVM native-image compiler should be installed and configured on your machine.
NOTE: GraalVM 22.3+ is required.
To create the executable, run the following goal:
$ ./mvnw native:compile -Pnative
Then, you can run the app as follows:
$ target/java-bot
You can also run your existing tests suite in a native image. This is an efficient way to validate the compatibility of your application.
To run your existing tests in a native image, run the following goal:
$ ./mvnw test -PnativeTest
This project uses Testcontainers at development time.
Testcontainers has been configured to use the following Docker images:
Please review the tags of the used images and set them to the same as you're running in production.
Due to Maven's design, elements are inherited from the parent POM to the project POM.
While most of the inheritance is fine, it also inherits unwanted elements like <license> and <developers> from the parent.
To prevent this, the project POM contains empty overrides for these elements.
If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides.