Difference between revisions of "IT-SDK-Java"
Jump to navigation
Jump to search
(→Startup) |
(→Quarkus) |
||
| Line 86: | Line 86: | ||
=Quarkus= | =Quarkus= | ||
==ref: Roadmap== | ==ref: Roadmap== | ||
| + | * https://lankydan.dev/building-a-rest-api-with-quarkus | ||
* https://github.com/quarkusio/quarkus-quickstarts | * https://github.com/quarkusio/quarkus-quickstarts | ||
* https://redhat-developer-demos.github.io/quarkus-tutorial/quarkus-tutorial/index.html | * https://redhat-developer-demos.github.io/quarkus-tutorial/quarkus-tutorial/index.html | ||
Revision as of 15:21, 18 March 2021
Contents
Links
- Books: https://www.manning.com/
- Tutorial: https://www.javatpoint.com/java-tutorial
- Tutorial: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/object-oriented-programming
- Tutorial: https://www.tutorialspoint.com/design_pattern/index.htm
- Tutorial: https://howtodoinjava.com/
- Patterns: https://en.wikipedia.org/wiki/Facade_pattern
- Patterns: https://www.baeldung.com/java-core-structural-patterns
- https://www.jrebel.com/blog/what-is-jrebel
- Hibernate: http://hibernate.org/
Setting
- JRE_HOME=C:\sdk\Java\jre_1.8.0_65
- JAVA_HOME=C:\sdk\Java\jdk_1.8.0_65
- JDK_HOME=C:\sdk\Java\jdk_1.8.0_65
Maven
wget https://www-us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
sudo tar xzf apache-maven-3.6.3-bin.tar.gz
sudo ln -s apache-maven-3.6.3 maven
sudo vi /etc/profile.d/maven.sh
-------------------------------------
export MAVEN_HOME=/opt/maven
export PATH=${MAVEN_HOME}/bin:${PATH}
-------------------------------------
source /etc/profile.d/maven.sh
mvn -version
Code-Collections
import java.util.concurrent.TimeUnit;
---------------------------------------------
try {
TimeUnit.SECONDS.sleep(secondsToSleep);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
---------------------------------------------
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import io.agroal.api.AgroalDataSource;
public class SettingDatabase{
AgroalDataSource dataSource;
String db = "jdbc:db2://localhost:5245/DATABASE:user=db2;password=db2;";
String sql = "SELECT * FROM users";
public void init_DriverManager()throws SQLException{
try{
Connection connection = DriverManager.getConnection(db); //Connection connection = AgroalDataSource.getConnection(db);
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
}
}
}
Architekture
Database
- JDBC is a low level standard for interaction with databases. JPA is higher level standard for the same purpose.
- JDBC allows you to do more things with the Database directly. JPA allows you to use an object model in your application.
- Datasource & Pooling (JDBC) >> Agroal
- Datasource & Pooling (Reactive) >> Vert.x
- Agroal is a datasource connection pool implementation with integration with transaction, security and other systems.
- Agroal library allows the definition of java.sql.DataSource with connection pooling.
- JPA (Java Persistence API) & Hibernate ORM (Object-relational mapping). JPA is only a specification. Hibernate is an implementation of JPA.
RESTFul
- RESTEasy is an implementation of JAX-RS and it is used to implement RestFul-services.
- Microservices communicating either synchronously via REST or asynchronously using Kafka.
Sprin Boot
Quarkus
ref: Roadmap
- https://lankydan.dev/building-a-rest-api-with-quarkus
- https://github.com/quarkusio/quarkus-quickstarts
- https://redhat-developer-demos.github.io/quarkus-tutorial/quarkus-tutorial/index.html
- -------------------------------------------------------
- https://quarkus.io/guides/datasource
- https://quarkus.io/guides/getting-started
- https://quarkus.io/guides/getting-started-reactive
- https://quarkus.io/guides/rest-json
- https://quarkus.io/guides/rest-client
- https://quarkus.io/guides/reactive-sql-clients
- https://quarkus.io/guides/hibernate-orm
- -------------------------------------------------------
- https://quarkus.io/guides/config
- https://quarkus.io/guides/config-reference
- https://quarkus.io/guides/all-config
- https://quarkus.io/guides/maven-tooling
- https://microprofile.io/project/eclipse/microprofile-config
- https://smallrye.io/docs/smallrye-config/index.html
- -------------------------------------------------------
- https://quarkus.io/guides/flyway
- https://quarkus.io/guides/microprofile-graphql
- https://quarkus.io/guides/kubernetes
- https://quarkus.io/quarkus-workshops/super-heroes
- ----------------------------------------------------
ref: Colletions
- https://github.com/quarkusio/quarkus/blob/master/integration-tests/flyway/src/main/java/io/quarkus/it/flyway/FlywayFunctionalityResource.java
- https://dzone.com/articles/building-a-rest-api-with-quarkus
- https://www.programcreek.com/java-api-examples/?code=quarkusio%2Fquarkus-quickstarts%2Fquarkus-quickstarts-master
- https://blogs.oracle.com/developers/configuring-the-oracle-jdbc-drivers-with-quarkus
- https://antoniogoncalves.org/2019/06/07/configuring-a-quarkus-application/
- https://dzone.com/articles/build-a-java-rest-api-with-quarkus
- https://dzone.com/articles/quick-guide-to-microservices-with-quarkus-on-opens
- http://www.mastertheboss.com/soa-cloud/quarkus/getting-started-with-quarkus
- https://www.mailing.dzone.com/click.html?x=a62e&lc=Uhy&mc=h&s=hbIX&u=f&z=oIlBEZc&
- https://jaxenter.de/serverless/quarkus-full-stack-framework-87817
docker pull maven:3.6-jdk-11-slim
Startup
mvn "io.quarkus:quarkus-maven-plugin:1.12.2.Final:create" \
-DprojectGroupId="net.condolco" \
-DprojectArtifactId="quarkus-app-00" \
-DclassName="init.SayHello" \
-Dpath="/hello" \
-Dextensions="resteasy,resteasy-jackson"
mvn quarkus:dev mvn compile quarkus:dev mvn quarkus:list-extensions mvn quarkus:add-extension -Dextensions="hibernate-validator" mvn quarkus:add-extension -Dextensions="hibernate-*" mvn quarkus:list-extensions
## mode: jvm mvn clean package -DskipTests java -jar target/tutorial-app-1.0-SNAPSHOT-runner.jar
## mode: native mvn clean package -DskipTests -Pnative ./target/tutorial-app-1.0-SNAPSHOT-runner
## mode: native contianer mvn package -DskipTests -Pnative -Dquarkus.native.container-build=true docker build -f src/main/docker/Dockerfile.native -t example/tutorial-app:1.0-SNAPSHOT . docker run -it --rm -p 8080:8080 example/tutorial-app:1.0-SNAPSHOT