Merge branch 'eugenp:master' into master
This commit is contained in:
commit
c34aacc618
@ -5,3 +5,5 @@ This module contains articles about core Java input/output(IO) APIs.
|
|||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
- [Constructing a Relative Path From Two Absolute Paths in Java](https://www.baeldung.com/java-relative-path-absolute)
|
- [Constructing a Relative Path From Two Absolute Paths in Java](https://www.baeldung.com/java-relative-path-absolute)
|
||||||
- [Java Scanner Taking a Character Input](https://www.baeldung.com/java-scanner-character-input)
|
- [Java Scanner Taking a Character Input](https://www.baeldung.com/java-scanner-character-input)
|
||||||
|
- [Get the Desktop Path in Java](https://www.baeldung.com/java-desktop-path)
|
||||||
|
|
||||||
|
@ -0,0 +1,85 @@
|
|||||||
|
package com.baeldung.scanner;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
|
import java.util.InputMismatchException;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class NextLineVsNextIntUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void whenInputLineIsNumber_thenNextLineAndNextIntBothWork() {
|
||||||
|
String input = "42\n";
|
||||||
|
|
||||||
|
//nextLine()
|
||||||
|
Scanner sc1 = new Scanner(input);
|
||||||
|
int num1 = Integer.parseInt(sc1.nextLine());
|
||||||
|
assertEquals(42, num1);
|
||||||
|
|
||||||
|
//nextInt()
|
||||||
|
Scanner sc2 = new Scanner(input);
|
||||||
|
int num2 = sc2.nextInt();
|
||||||
|
assertEquals(42, num2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void whenInputIsNotValidNumber_thenNextLineAndNextIntThrowDifferentException() {
|
||||||
|
String input = "Nan\n";
|
||||||
|
|
||||||
|
//nextLine() -> NumberFormatException
|
||||||
|
Scanner sc1 = new Scanner(input);
|
||||||
|
assertThrows(NumberFormatException.class, () -> Integer.parseInt(sc1.nextLine()));
|
||||||
|
|
||||||
|
//nextInt() -> InputMismatchException
|
||||||
|
Scanner sc2 = new Scanner(input);
|
||||||
|
assertThrows(InputMismatchException.class, sc2::nextInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void whenUsingNextInt_thenTheNextTokenAfterItFailsToParseIsNotConsumed() {
|
||||||
|
String input = "42 is a magic number\n";
|
||||||
|
|
||||||
|
//nextInt() to read '42'
|
||||||
|
Scanner sc2 = new Scanner(input);
|
||||||
|
int num2 = sc2.nextInt();
|
||||||
|
assertEquals(42, num2);
|
||||||
|
|
||||||
|
// call nextInt() again on "is"
|
||||||
|
assertThrows(InputMismatchException.class, sc2::nextInt);
|
||||||
|
|
||||||
|
String theNextToken = sc2.next();
|
||||||
|
assertEquals("is", theNextToken);
|
||||||
|
|
||||||
|
theNextToken = sc2.next();
|
||||||
|
assertEquals("a", theNextToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void whenReadingTwoInputLines_thenNextLineAndNextIntBehaveDifferently() {
|
||||||
|
|
||||||
|
String input = new StringBuilder().append("42\n")
|
||||||
|
.append("It is a magic number.\n")
|
||||||
|
.toString();
|
||||||
|
|
||||||
|
//nextLine()
|
||||||
|
Scanner sc1 = new Scanner(input);
|
||||||
|
int num1 = Integer.parseInt(sc1.nextLine());
|
||||||
|
String nextLineText1 = sc1.nextLine();
|
||||||
|
assertEquals(42, num1);
|
||||||
|
assertEquals("It is a magic number.", nextLineText1);
|
||||||
|
|
||||||
|
//nextInt()
|
||||||
|
Scanner sc2 = new Scanner(input);
|
||||||
|
int num2 = sc2.nextInt();
|
||||||
|
assertEquals(42, num2);
|
||||||
|
|
||||||
|
// nextInt() leaves the newline character (\n) behind
|
||||||
|
String nextLineText2 = sc2.nextLine();
|
||||||
|
assertEquals("", nextLineText2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -14,5 +14,4 @@ This module contains articles about core Java non-blocking input and output (IO)
|
|||||||
- [What Is the Difference Between NIO and NIO.2?](https://www.baeldung.com/java-nio-vs-nio-2)
|
- [What Is the Difference Between NIO and NIO.2?](https://www.baeldung.com/java-nio-vs-nio-2)
|
||||||
- [Guide to ByteBuffer](https://www.baeldung.com/java-bytebuffer)
|
- [Guide to ByteBuffer](https://www.baeldung.com/java-bytebuffer)
|
||||||
- [Find Files that Match Wildcard Strings in Java](https://www.baeldung.com/java-files-match-wildcard-strings)
|
- [Find Files that Match Wildcard Strings in Java](https://www.baeldung.com/java-files-match-wildcard-strings)
|
||||||
- [Get the Desktop Path in Java](https://www.baeldung.com/java-desktop-path)
|
|
||||||
- [[<-- Prev]](/core-java-modules/core-java-nio)
|
- [[<-- Prev]](/core-java-modules/core-java-nio)
|
||||||
|
@ -10,4 +10,3 @@
|
|||||||
- [Understanding the Difference Between Stream.of() and IntStream.range()](https://www.baeldung.com/java-stream-of-and-intstream-range)
|
- [Understanding the Difference Between Stream.of() and IntStream.range()](https://www.baeldung.com/java-stream-of-and-intstream-range)
|
||||||
- [Check if Object Is an Array in Java](https://www.baeldung.com/java-check-if-object-is-an-array)
|
- [Check if Object Is an Array in Java](https://www.baeldung.com/java-check-if-object-is-an-array)
|
||||||
- [Mapping an Array of Integers to Strings Using Java Streams](https://www.baeldung.com/java-stream-integer-array-to-strings)
|
- [Mapping an Array of Integers to Strings Using Java Streams](https://www.baeldung.com/java-stream-integer-array-to-strings)
|
||||||
- [Difference Between parallelStream() and stream().parallel() in Java](https://www.baeldung.com/java-parallelstream-vs-stream-parallel)
|
|
||||||
|
1
core-java-modules/core-java-streams-5/README.md
Normal file
1
core-java-modules/core-java-streams-5/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- [Difference Between parallelStream() and stream().parallel() in Java](https://www.baeldung.com/java-parallelstream-vs-stream-parallel)
|
72
core-java-modules/core-java-streams-5/pom.xml
Normal file
72
core-java-modules/core-java-streams-5/pom.xml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?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>
|
||||||
|
<artifactId>core-java-streams-5</artifactId>
|
||||||
|
<name>core-java-streams-5</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung.core-java-modules</groupId>
|
||||||
|
<artifactId>core-java-modules</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
<version>${log4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit</groupId>
|
||||||
|
<artifactId>junit-bom</artifactId>
|
||||||
|
<version>${junit-jupiter.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>3.23.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.12.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>core-java-streams-4</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>../core-java-streams-4/src/main</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
<compilerArgument>-parameters</compilerArgument>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<!-- testing -->
|
||||||
|
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
|
||||||
|
<maven.compiler.source>12</maven.compiler.source>
|
||||||
|
<maven.compiler.target>12</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -1,6 +1,5 @@
|
|||||||
package parallelstream;
|
package com.baeldung.parallelstream;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
@ -15,13 +15,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>com.sun</groupId>
|
|
||||||
<artifactId>tools</artifactId>
|
|
||||||
<version>${tools.version}</version>
|
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>${java.home}/../lib/tools.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -32,10 +26,25 @@
|
|||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source.version}</source>
|
||||||
|
<target>${maven.compiler.target.version}</target>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>--add-exports=jdk.jdi/com.sun.jdi=ALL-UNNAMED</arg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tools.version>1.8</tools.version>
|
<maven.compiler.source.version>17</maven.compiler.source.version>
|
||||||
|
<maven.compiler.target.version>17</maven.compiler.target.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
1
libraries-ai/README.md
Normal file
1
libraries-ai/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
33
libraries-ai/pom.xml
Normal file
33
libraries-ai/pom.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?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>
|
||||||
|
<artifactId>libraries-ai</artifactId>
|
||||||
|
<name>libraries-ai</name>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>parent-modules</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>edu.stanford.nlp</groupId>
|
||||||
|
<artifactId>stanford-corenlp</artifactId>
|
||||||
|
<version>${stanford-corenlp.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.opennlp</groupId>
|
||||||
|
<artifactId>opennlp-tools</artifactId>
|
||||||
|
<version>${opennlp-tools.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<stanford-corenlp.version>4.5.3</stanford-corenlp.version>
|
||||||
|
<opennlp-tools.version>2.1.1</opennlp-tools.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.baeldung.nlp;
|
||||||
|
|
||||||
|
import edu.stanford.nlp.ling.CoreAnnotations;
|
||||||
|
import edu.stanford.nlp.ling.CoreLabel;
|
||||||
|
import edu.stanford.nlp.pipeline.Annotation;
|
||||||
|
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
|
||||||
|
import edu.stanford.nlp.util.CoreMap;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class CoreNLPTokenizerUnitTest {
|
||||||
|
@Test
|
||||||
|
public void givenSampleText_whenTokenize_thenExpectedTokensReturned() {
|
||||||
|
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.setProperty("annotators", "tokenize");
|
||||||
|
|
||||||
|
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
|
||||||
|
String text = "The german shepard display an act of kindness";
|
||||||
|
|
||||||
|
Annotation document = new Annotation(text);
|
||||||
|
pipeline.annotate(document);
|
||||||
|
|
||||||
|
List<CoreMap> sentences = document.get(CoreAnnotations.SentencesAnnotation.class);
|
||||||
|
StringBuilder tokens = new StringBuilder();
|
||||||
|
|
||||||
|
for (CoreMap sentence : sentences) {
|
||||||
|
for (CoreLabel token : sentence.get(CoreAnnotations.TokensAnnotation.class)) {
|
||||||
|
String word = token.get(CoreAnnotations.TextAnnotation.class);
|
||||||
|
tokens.append(word)
|
||||||
|
.append(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertEquals("The german shepard display an act of kindness", tokens.toString()
|
||||||
|
.trim());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.baeldung.nlp;
|
||||||
|
|
||||||
|
import opennlp.tools.langdetect.Language;
|
||||||
|
import opennlp.tools.langdetect.LanguageDetectorME;
|
||||||
|
import opennlp.tools.langdetect.LanguageDetectorModel;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
class OpenNLPLanguageDetector {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenTextInEnglish_whenDetectLanguage_thenReturnsEnglishLanguageCode() {
|
||||||
|
|
||||||
|
String text = "the dream my father told me";
|
||||||
|
LanguageDetectorModel model;
|
||||||
|
|
||||||
|
try (InputStream modelIn = new FileInputStream("langdetect-183.bin")) {
|
||||||
|
model = new LanguageDetectorModel(modelIn);
|
||||||
|
} catch (IOException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LanguageDetectorME detector = new LanguageDetectorME(model);
|
||||||
|
Language language = detector.predictLanguage(text);
|
||||||
|
|
||||||
|
assertEquals("eng", language.getLang());
|
||||||
|
}
|
||||||
|
}
|
@ -134,6 +134,11 @@
|
|||||||
<version>${byte-buddy.version}</version>
|
<version>${byte-buddy.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger.parser.v3</groupId>
|
||||||
|
<artifactId>swagger-parser</artifactId>
|
||||||
|
<version>${swagger-parser.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -171,6 +176,7 @@
|
|||||||
<derive4j.version>1.1.0</derive4j.version>
|
<derive4j.version>1.1.0</derive4j.version>
|
||||||
<awaitility.version>3.0.0</awaitility.version>
|
<awaitility.version>3.0.0</awaitility.version>
|
||||||
<univocity.version>2.8.4</univocity.version>
|
<univocity.version>2.8.4</univocity.version>
|
||||||
|
<swagger-parser.version>2.1.13</swagger-parser.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -0,0 +1,92 @@
|
|||||||
|
package com.baeldung.swaggerparser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.swagger.parser.OpenAPIParser;
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.PathItem;
|
||||||
|
import io.swagger.v3.oas.models.Paths;
|
||||||
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
|
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||||
|
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||||
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
|
import io.swagger.v3.parser.core.models.SwaggerParseResult;
|
||||||
|
|
||||||
|
public class SwaggerParser {
|
||||||
|
|
||||||
|
private static String OPENAPI_SPECIFICATION_STRING = "{\"openapi\":\"3.0.0\",\"info\":{\"title\":\"User APIs\",\"version\":\"1.0\"},\"servers\":[{\"url\":\"https://jsonplaceholder.typicode.com\",\"description\":\"Json Place Holder Service\"}],\"paths\":{\"/users/{id}\":{\"parameters\":[{\"schema\":{\"type\":\"integer\"},\"name\":\"id\",\"in\":\"path\",\"required\":true}],\"get\":{\"summary\":\"Fetch user by ID\",\"tags\":[\"User\"],\"responses\":{\"200\":{\"description\":\"OK\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"integer\"},\"name\":{\"type\":\"string\"}}}}}}},\"operationId\":\"get-users-user_id\",\"description\":\"Retrieve a specific user by ID\"}}}}";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
parseYAMLFile();
|
||||||
|
parseJSONFile();
|
||||||
|
parseString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void parseString() {
|
||||||
|
SwaggerParseResult result = new OpenAPIParser().readContents(OPENAPI_SPECIFICATION_STRING, null, null);
|
||||||
|
|
||||||
|
OpenAPI openAPI = result.getOpenAPI();
|
||||||
|
|
||||||
|
if (openAPI != null) {
|
||||||
|
printData(openAPI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void parseJSONFile() {
|
||||||
|
SwaggerParseResult result = new OpenAPIParser().readLocation("sample.yml", null, null);
|
||||||
|
|
||||||
|
OpenAPI openAPI = result.getOpenAPI();
|
||||||
|
|
||||||
|
if (openAPI != null) {
|
||||||
|
printData(openAPI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void parseYAMLFile() {
|
||||||
|
SwaggerParseResult result = new OpenAPIParser().readLocation("sample.json", null, null);
|
||||||
|
|
||||||
|
OpenAPI openAPI = result.getOpenAPI();
|
||||||
|
|
||||||
|
if (openAPI != null) {
|
||||||
|
printData(openAPI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void printData(OpenAPI openAPI) {
|
||||||
|
System.out.println(openAPI.getSpecVersion());
|
||||||
|
|
||||||
|
Info info = openAPI.getInfo();
|
||||||
|
System.out.println(info.getTitle());
|
||||||
|
System.out.println(info.getVersion());
|
||||||
|
|
||||||
|
List<Server> servers = openAPI.getServers();
|
||||||
|
for (Server server : servers) {
|
||||||
|
System.out.println(server.getUrl());
|
||||||
|
System.out.println(server.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
Paths paths = openAPI.getPaths();
|
||||||
|
paths.entrySet()
|
||||||
|
.forEach(pathEntry -> {
|
||||||
|
System.out.println(pathEntry.getKey());
|
||||||
|
|
||||||
|
PathItem path = pathEntry.getValue();
|
||||||
|
System.out.println(path.getGet()
|
||||||
|
.getSummary());
|
||||||
|
System.out.println(path.getGet()
|
||||||
|
.getDescription());
|
||||||
|
System.out.println(path.getGet()
|
||||||
|
.getOperationId());
|
||||||
|
|
||||||
|
ApiResponses responses = path.getGet()
|
||||||
|
.getResponses();
|
||||||
|
responses.entrySet()
|
||||||
|
.forEach(responseEntry -> {
|
||||||
|
System.out.println(responseEntry.getKey());
|
||||||
|
|
||||||
|
ApiResponse response = responseEntry.getValue();
|
||||||
|
System.out.println(response.getDescription());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
55
libraries-data-2/src/main/resources/sample.json
Normal file
55
libraries-data-2/src/main/resources/sample.json
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.0.0",
|
||||||
|
"info": {
|
||||||
|
"title": "User APIs",
|
||||||
|
"version": "1.0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "https://jsonplaceholder.typicode.com",
|
||||||
|
"description": "Json Place Holder Service"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/users/{id}": {
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"get": {
|
||||||
|
"summary": "Fetch user by ID",
|
||||||
|
"tags": [
|
||||||
|
"User"
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"operationId": "get-users-user_id",
|
||||||
|
"description": "Retrieve a specific user by ID"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
libraries-data-2/src/main/resources/sample.yml
Normal file
33
libraries-data-2/src/main/resources/sample.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
title: User APIs
|
||||||
|
version: '1.0'
|
||||||
|
servers:
|
||||||
|
- url: https://jsonplaceholder.typicode.com
|
||||||
|
description: Json Place Holder Service
|
||||||
|
paths:
|
||||||
|
/users/{id}:
|
||||||
|
parameters:
|
||||||
|
- schema:
|
||||||
|
type: integer
|
||||||
|
name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
get:
|
||||||
|
summary: Fetch user by ID
|
||||||
|
tags:
|
||||||
|
- User
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
operationId: get-users-user_id
|
||||||
|
description: Retrieve a specific user by ID
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.baeldung.swaggerparser;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import io.swagger.parser.OpenAPIParser;
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.parser.core.models.SwaggerParseResult;
|
||||||
|
|
||||||
|
public class SwaggerParserUnitTest {
|
||||||
|
|
||||||
|
private static String OPENAPI_SPECIFICATION_STRING = "{\"openapi\":\"3.0.0\",\"info\":{\"title\":\"User APIs\",\"version\":\"1.0\"},\"servers\":[{\"url\":\"https://jsonplaceholder.typicode.com\",\"description\":\"Json Place Holder Service\"}],\"paths\":{\"/users/{id}\":{\"parameters\":[{\"schema\":{\"type\":\"integer\"},\"name\":\"id\",\"in\":\"path\",\"required\":true}],\"get\":{\"summary\":\"Fetch user by ID\",\"tags\":[\"User\"],\"responses\":{\"200\":{\"description\":\"OK\",\"content\":{\"application/json\":{\"schema\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"integer\"},\"name\":{\"type\":\"string\"}}}}}}},\"operationId\":\"get-users-user_id\",\"description\":\"Retrieve a specific user by ID\"}}}}";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenAValidOpenAPIYAMLFile_whenParsing_thenCheckIfParsed() {
|
||||||
|
SwaggerParseResult result = new OpenAPIParser().readLocation("valid-openapi-sample.yml", null, null);
|
||||||
|
|
||||||
|
OpenAPI openAPI = result.getOpenAPI();
|
||||||
|
|
||||||
|
assertNotNull(openAPI);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenAValidOpenAPIYAMLFile_whenParsing_thenCheckIfNotErrors() {
|
||||||
|
SwaggerParseResult result = new OpenAPIParser().readLocation("valid-openapi-sample.yml", null, null);
|
||||||
|
|
||||||
|
List<String> messages = result.getMessages();
|
||||||
|
|
||||||
|
assertTrue(messages.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenAnInvalidOpenAPIYAMLFile_whenParsing_thenCheckIfErrors() {
|
||||||
|
SwaggerParseResult result = new OpenAPIParser().readLocation("invalid-openapi-sample.yml", null, null);
|
||||||
|
|
||||||
|
List<String> messages = result.getMessages();
|
||||||
|
|
||||||
|
assertFalse(messages.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenAValidOpenAPISpecificationString_whenParsing_thenCheckIfParsed() {
|
||||||
|
SwaggerParseResult result = new OpenAPIParser().readContents(OPENAPI_SPECIFICATION_STRING, null, null);
|
||||||
|
|
||||||
|
OpenAPI openAPI = result.getOpenAPI();
|
||||||
|
|
||||||
|
assertNotNull(openAPI);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenAValidOpenAPISpecificationString_whenParsing_thenCheckIfNotErrors() {
|
||||||
|
SwaggerParseResult result = new OpenAPIParser().readLocation(OPENAPI_SPECIFICATION_STRING, null, null);
|
||||||
|
|
||||||
|
List<String> messages = result.getMessages();
|
||||||
|
|
||||||
|
assertNull(messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
title: User APIs
|
||||||
|
version: '1.0'
|
||||||
|
servers:
|
||||||
|
- description: Json Place Holder Service
|
||||||
|
paths:
|
||||||
|
/users/{id}:
|
||||||
|
parameters:
|
||||||
|
- schema:
|
||||||
|
type: integer
|
||||||
|
name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
get:
|
||||||
|
summary: Fetch user by ID
|
||||||
|
tags:
|
||||||
|
- User
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
operationId: get-users-user_id
|
||||||
|
description: Retrieve a specific user by ID
|
33
libraries-data-2/src/test/resources/valid-openapi-sample.yml
Normal file
33
libraries-data-2/src/test/resources/valid-openapi-sample.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
title: User APIs
|
||||||
|
version: '1.0'
|
||||||
|
servers:
|
||||||
|
- url: https://jsonplaceholder.typicode.com
|
||||||
|
description: Json Place Holder Service
|
||||||
|
paths:
|
||||||
|
/users/{id}:
|
||||||
|
parameters:
|
||||||
|
- schema:
|
||||||
|
type: integer
|
||||||
|
name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
get:
|
||||||
|
summary: Fetch user by ID
|
||||||
|
tags:
|
||||||
|
- User
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
operationId: get-users-user_id
|
||||||
|
description: Retrieve a specific user by ID
|
13
pom.xml
13
pom.xml
@ -354,8 +354,6 @@
|
|||||||
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
||||||
<!-- <module>guest</module> --> <!-- not to be built as its for guest articles -->
|
<!-- <module>guest</module> --> <!-- not to be built as its for guest articles -->
|
||||||
|
|
||||||
<module>java-jdi</module>
|
|
||||||
|
|
||||||
<module>jetbrains</module>
|
<module>jetbrains</module>
|
||||||
<!-- <module>lagom</module> --> <!-- Not a maven project -->
|
<!-- <module>lagom</module> --> <!-- Not a maven project -->
|
||||||
<module>language-interop</module>
|
<module>language-interop</module>
|
||||||
@ -547,8 +545,6 @@
|
|||||||
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
||||||
<!-- <module>guest</module> --> <!-- not to be built as its for guest articles -->
|
<!-- <module>guest</module> --> <!-- not to be built as its for guest articles -->
|
||||||
|
|
||||||
<module>java-jdi</module>
|
|
||||||
|
|
||||||
<!-- <module>lagom</module> --> <!-- Not a maven project -->
|
<!-- <module>lagom</module> --> <!-- Not a maven project -->
|
||||||
<module>language-interop</module>
|
<module>language-interop</module>
|
||||||
|
|
||||||
@ -800,7 +796,6 @@
|
|||||||
<!-- <module>core-java-modules/core-java-17</module> --> <!-- uses preview features, to be decided how to handle -->
|
<!-- <module>core-java-modules/core-java-17</module> --> <!-- uses preview features, to be decided how to handle -->
|
||||||
<!-- <module>core-java-modules/core-java-19</module> --> <!-- uses preview features, to be decided how to handle -->
|
<!-- <module>core-java-modules/core-java-19</module> --> <!-- uses preview features, to be decided how to handle -->
|
||||||
<module>custom-pmd</module>
|
<module>custom-pmd</module>
|
||||||
<module>spring-core-6</module>
|
|
||||||
<module>data-structures</module>
|
<module>data-structures</module>
|
||||||
<module>ddd-contexts</module>
|
<module>ddd-contexts</module>
|
||||||
<module>jackson-modules</module>
|
<module>jackson-modules</module>
|
||||||
@ -868,7 +863,7 @@
|
|||||||
<module>hystrix</module>
|
<module>hystrix</module>
|
||||||
<module>jackson-simple</module>
|
<module>jackson-simple</module>
|
||||||
<module>java-blockchain</module>
|
<module>java-blockchain</module>
|
||||||
|
<module>java-jdi</module>
|
||||||
<module>java-rmi</module>
|
<module>java-rmi</module>
|
||||||
<module>java-spi</module>
|
<module>java-spi</module>
|
||||||
<module>javax-sound</module>
|
<module>javax-sound</module>
|
||||||
@ -923,7 +918,6 @@
|
|||||||
<module>spring-activiti</module>
|
<module>spring-activiti</module>
|
||||||
<module>spring-core-2</module>
|
<module>spring-core-2</module>
|
||||||
<module>spring-core-3</module>
|
<module>spring-core-3</module>
|
||||||
<module>spring-core-5</module>
|
|
||||||
<module>spring-di-3</module>
|
<module>spring-di-3</module>
|
||||||
<module>spring-cucumber</module>
|
<module>spring-cucumber</module>
|
||||||
|
|
||||||
@ -1053,7 +1047,6 @@
|
|||||||
<module>spring-aop</module>
|
<module>spring-aop</module>
|
||||||
<module>spring-aop-2</module>
|
<module>spring-aop-2</module>
|
||||||
<module>custom-pmd</module>
|
<module>custom-pmd</module>
|
||||||
<module>spring-core-6</module>
|
|
||||||
<module>data-structures</module>
|
<module>data-structures</module>
|
||||||
<module>ddd-contexts</module>
|
<module>ddd-contexts</module>
|
||||||
<module>jackson-modules</module>
|
<module>jackson-modules</module>
|
||||||
@ -1123,7 +1116,7 @@
|
|||||||
<module>hystrix</module>
|
<module>hystrix</module>
|
||||||
<module>jackson-simple</module>
|
<module>jackson-simple</module>
|
||||||
<module>java-blockchain</module>
|
<module>java-blockchain</module>
|
||||||
|
<module>java-jdi</module>
|
||||||
<module>java-rmi</module>
|
<module>java-rmi</module>
|
||||||
<module>java-spi</module>
|
<module>java-spi</module>
|
||||||
<module>javax-sound</module>
|
<module>javax-sound</module>
|
||||||
@ -1152,6 +1145,7 @@
|
|||||||
<module>libraries-http</module>
|
<module>libraries-http</module>
|
||||||
<module>libraries-http-2</module>
|
<module>libraries-http-2</module>
|
||||||
<module>libraries-io</module>
|
<module>libraries-io</module>
|
||||||
|
<module>libraries-ai</module>
|
||||||
<module>libraries-primitive</module>
|
<module>libraries-primitive</module>
|
||||||
<module>libraries-rpc</module>
|
<module>libraries-rpc</module>
|
||||||
<module>libraries-server</module>
|
<module>libraries-server</module>
|
||||||
@ -1178,7 +1172,6 @@
|
|||||||
<module>spring-activiti</module>
|
<module>spring-activiti</module>
|
||||||
<module>spring-core-2</module>
|
<module>spring-core-2</module>
|
||||||
<module>spring-core-3</module>
|
<module>spring-core-3</module>
|
||||||
<module>spring-core-5</module>
|
|
||||||
<module>spring-di-3</module>
|
<module>spring-di-3</module>
|
||||||
<module>spring-cucumber</module>
|
<module>spring-cucumber</module>
|
||||||
|
|
||||||
|
13
spring-core-2/.gitignore
vendored
13
spring-core-2/.gitignore
vendored
@ -1,13 +0,0 @@
|
|||||||
*.class
|
|
||||||
|
|
||||||
#folders#
|
|
||||||
/target
|
|
||||||
/neoDb*
|
|
||||||
/data
|
|
||||||
/src/main/webapp/WEB-INF/classes
|
|
||||||
*/META-INF/*
|
|
||||||
|
|
||||||
# Packaged files #
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.ear
|
|
@ -6,4 +6,9 @@ This module contains articles about core Spring functionality
|
|||||||
|
|
||||||
- [Quick Guide to Spring Bean Scopes](http://www.baeldung.com/spring-bean-scopes)
|
- [Quick Guide to Spring Bean Scopes](http://www.baeldung.com/spring-bean-scopes)
|
||||||
- [Spring Events](https://www.baeldung.com/spring-events)
|
- [Spring Events](https://www.baeldung.com/spring-events)
|
||||||
|
- [Solving Spring’s “not eligible for auto-proxying” Warning](https://www.baeldung.com/spring-not-eligible-for-auto-proxying)
|
||||||
|
- [Finding the Spring Version](https://www.baeldung.com/spring-find-version)
|
||||||
|
- [How Does the Spring Singleton Bean Serve Concurrent Requests?](https://www.baeldung.com/spring-singleton-concurrent-requests)
|
||||||
|
- [Reinitialize Singleton Bean in Spring Context](https://www.baeldung.com/spring-reinitialize-singleton-bean)
|
||||||
|
- [Getting the Current ApplicationContext in Spring](https://www.baeldung.com/spring-get-current-applicationcontext)
|
||||||
- More articles: [[<-- prev]](/spring-core)[[next -->]](/spring-core-3)
|
- More articles: [[<-- prev]](/spring-core)[[next -->]](/spring-core-3)
|
||||||
|
@ -15,29 +15,15 @@
|
|||||||
<relativePath>../parent-boot-2</relativePath>
|
<relativePath>../parent-boot-2</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-framework-bom</artifactId>
|
|
||||||
<version>${org.springframework.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-core</artifactId>
|
|
||||||
<version>${org.springframework.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
|
||||||
<version>${org.springframework.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
@ -129,6 +115,11 @@
|
|||||||
<artifactId>spring-test</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<!-- ShedLock -->
|
<!-- ShedLock -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.javacrumbs.shedlock</groupId>
|
<groupId>net.javacrumbs.shedlock</groupId>
|
||||||
@ -140,6 +131,10 @@
|
|||||||
<artifactId>shedlock-provider-jdbc-template</artifactId>
|
<artifactId>shedlock-provider-jdbc-template</artifactId>
|
||||||
<version>${shedlock.version}</version>
|
<version>${shedlock.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -164,8 +159,6 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<start-class>com.baeldung.sample.App</start-class>
|
<start-class>com.baeldung.sample.App</start-class>
|
||||||
<!-- Spring -->
|
|
||||||
<org.springframework.version>5.3.0</org.springframework.version>
|
|
||||||
<annotation-api.version>1.3.2</annotation-api.version>
|
<annotation-api.version>1.3.2</annotation-api.version>
|
||||||
<!-- persistence -->
|
<!-- persistence -->
|
||||||
<hibernate.version>5.2.5.Final</hibernate.version>
|
<hibernate.version>5.2.5.Final</hibernate.version>
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
config.file.path=./spring-core-2/src/main/resources/config.properties
|
@ -10,4 +10,5 @@ This module contains articles about core Spring functionality
|
|||||||
- [Design Patterns in the Spring Framework](https://www.baeldung.com/spring-framework-design-patterns)
|
- [Design Patterns in the Spring Framework](https://www.baeldung.com/spring-framework-design-patterns)
|
||||||
- [Difference Between BeanFactory and ApplicationContext](https://www.baeldung.com/spring-beanfactory-vs-applicationcontext)
|
- [Difference Between BeanFactory and ApplicationContext](https://www.baeldung.com/spring-beanfactory-vs-applicationcontext)
|
||||||
- [Custom Scope in Spring](http://www.baeldung.com/spring-custom-scope)
|
- [Custom Scope in Spring](http://www.baeldung.com/spring-custom-scope)
|
||||||
|
- [The Spring ApplicationContext](https://www.baeldung.com/spring-application-context)
|
||||||
- More articles: [[<-- prev]](/spring-core-2) [[next -->]](/spring-core-4)
|
- More articles: [[<-- prev]](/spring-core-2) [[next -->]](/spring-core-4)
|
||||||
|
@ -6,5 +6,4 @@ This module contains articles about core Spring functionality
|
|||||||
|
|
||||||
- [Creating Spring Beans Through Factory Methods](https://www.baeldung.com/spring-beans-factory-methods)
|
- [Creating Spring Beans Through Factory Methods](https://www.baeldung.com/spring-beans-factory-methods)
|
||||||
- [Spring BeanPostProcessor](https://www.baeldung.com/spring-beanpostprocessor)
|
- [Spring BeanPostProcessor](https://www.baeldung.com/spring-beanpostprocessor)
|
||||||
- [The Spring ApplicationContext](https://www.baeldung.com/spring-application-context)
|
- More articles: [[<-- prev]](/spring-core-3)
|
||||||
- More articles: [[<-- prev]](/spring-core-3) [[next -->]](/spring-core-5)
|
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
## Spring Core
|
|
||||||
|
|
||||||
This module contains articles about core Spring functionality.
|
|
||||||
|
|
||||||
## Relevant Articles:
|
|
||||||
|
|
||||||
- [Solving Spring’s “not eligible for auto-proxying” Warning](https://www.baeldung.com/spring-not-eligible-for-auto-proxying)
|
|
||||||
- [Finding the Spring Version](https://www.baeldung.com/spring-find-version)
|
|
||||||
- [How Does the Spring Singleton Bean Serve Concurrent Requests?](https://www.baeldung.com/spring-singleton-concurrent-requests)
|
|
||||||
- More articles: [[<-- prev]](../spring-core-4)
|
|
@ -1,45 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<artifactId>spring-core-5</artifactId>
|
|
||||||
<name>spring-core-5</name>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<artifactId>parent-spring-5</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../parent-spring-5</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
<version>${spring-boot-starter.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
<version>${spring-boot-starter.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<version>${spring-boot-starter.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>${lombok.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<spring.version>5.3.3</spring.version>
|
|
||||||
<spring-boot-starter.version>2.4.2</spring-boot-starter.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="15 seconds" debug="false">
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>[%d{ISO8601}]-[%thread] %-5level %logger - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="INFO">
|
|
||||||
<appender-ref ref="STDOUT" />
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
### Relevant Articles:
|
|
||||||
- [Reinitialize Singleton Bean in Spring Context](https://www.baeldung.com/spring-reinitialize-singleton-bean)
|
|
||||||
- [Getting the Current ApplicationContext in Spring](https://www.baeldung.com/spring-get-current-applicationcontext)
|
|
||||||
- More articles: [[<-- prev]](../spring-core-5)
|
|
@ -1,95 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<artifactId>spring-core-6</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<name>spring-core-6</name>
|
|
||||||
<url>http://www.baeldung.com</url>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<artifactId>parent-boot-3</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../parent-boot-3</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.projectreactor</groupId>
|
|
||||||
<artifactId>reactor-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
|
||||||
<version>3.1.0</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
|
||||||
<version>3.0.2</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.0</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.22.1</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<version>3.0.2</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
|
||||||
<version>2.5.2</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
|
||||||
<version>2.8.2</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
|
||||||
<version>3.7.1</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
|
||||||
<version>3.0.0</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>17</source>
|
|
||||||
<target>17</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1 +0,0 @@
|
|||||||
config.file.path=./spring-core-6/src/main/resources/config.properties
|
|
Loading…
x
Reference in New Issue
Block a user