Merge branch 'master' into BAEL-11403
This commit is contained in:
commit
01ded32d6a
@ -35,3 +35,5 @@
|
||||
- [Guide to Java OutputStream](https://www.baeldung.com/java-outputstream)
|
||||
- [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array)
|
||||
- [Guide to BufferedReader](https://www.baeldung.com/java-buffered-reader)
|
||||
- [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension)
|
||||
- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type)
|
@ -160,6 +160,17 @@
|
||||
<version>${opencsv.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Mime Type Resolution Libraries -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tika</groupId>
|
||||
<artifactId>tika-core</artifactId>
|
||||
<version>${tika.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.jmimemagic</groupId>
|
||||
<artifactId>jmimemagic</artifactId>
|
||||
<version>${jmime-magic.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -264,6 +275,9 @@
|
||||
<esapi.version>2.1.0.1</esapi.version>
|
||||
<jmh-generator-annprocess.version>1.19</jmh-generator-annprocess.version>
|
||||
<async-http-client.version>2.4.5</async-http-client.version>
|
||||
<!-- Mime Type Libraries -->
|
||||
<tika.version>1.18</tika.version>
|
||||
<jmime-magic.version>0.1.5</jmime-magic.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
11
core-java-security/README.md
Normal file
11
core-java-security/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
## Core Java Security
|
||||
|
||||
### Relevant Articles:
|
||||
- [MD5 Hashing in Java](http://www.baeldung.com/java-md5)
|
||||
- [Guide to the Cipher Class](http://www.baeldung.com/java-cipher-class)
|
||||
- [Introduction to SSL in Java](http://www.baeldung.com/java-ssl)
|
||||
- [Java KeyStore API](http://www.baeldung.com/java-keystore)
|
||||
- [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream)
|
||||
- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing)
|
||||
- [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures)
|
||||
- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java)
|
55
core-java-security/pom.xml
Normal file
55
core-java-security/pom.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<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>core-java-security</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>core-java-security</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-java</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-java</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
<!-- test scoped -->
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>${assertj-core.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${commons-codec.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>${bouncycastle.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
||||
<!-- util -->
|
||||
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||
<bouncycastle.version>1.55</bouncycastle.version>
|
||||
<commons-codec.version>1.10</commons-codec.version>
|
||||
|
||||
<!-- testing -->
|
||||
<assertj-core.version>3.10.0</assertj-core.version>
|
||||
|
||||
</properties>
|
||||
|
||||
</project>
|
19
core-java-security/src/main/resources/logback.xml
Normal file
19
core-java-security/src/main/resources/logback.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.springframework" level="WARN" />
|
||||
<logger name="org.springframework.transaction" level="WARN" />
|
||||
|
||||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
@ -5,7 +5,6 @@
|
||||
### Relevant Articles:
|
||||
- [Java Timer](http://www.baeldung.com/java-timer-and-timertask)
|
||||
- [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java)
|
||||
- [MD5 Hashing in Java](http://www.baeldung.com/java-md5)
|
||||
- [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java)
|
||||
- [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java)
|
||||
- [Getting Started with Java Properties](http://www.baeldung.com/java-properties)
|
||||
@ -23,7 +22,7 @@
|
||||
- [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri)
|
||||
- [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin)
|
||||
- [Quick Guide to Java Stack](http://www.baeldung.com/java-stack)
|
||||
- [Guide to the Cipher Class](http://www.baeldung.com/java-cipher-class)
|
||||
- [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter)
|
||||
- [Compiling Java *.class Files with javac](http://www.baeldung.com/javac)
|
||||
- [Introduction to Javadoc](http://www.baeldung.com/javadoc)
|
||||
- [Guide to the Externalizable Interface in Java](http://www.baeldung.com/java-externalizable)
|
||||
@ -32,22 +31,22 @@
|
||||
- [What is the serialVersionUID?](http://www.baeldung.com/java-serial-version-uid)
|
||||
- [A Guide to the ResourceBundle](http://www.baeldung.com/java-resourcebundle)
|
||||
- [Class Loaders in Java](http://www.baeldung.com/java-classloaders)
|
||||
- [Introduction to SSL in Java](http://www.baeldung.com/java-ssl)
|
||||
- [Java KeyStore API](http://www.baeldung.com/java-keystore)
|
||||
- [Double-Checked Locking with Singleton](http://www.baeldung.com/java-singleton-double-checked-locking)
|
||||
- [Guide to Java Clock Class](http://www.baeldung.com/java-clock)
|
||||
- [Importance of Main Manifest Attribute in a Self-Executing JAR](http://www.baeldung.com/java-jar-executable-manifest-main-class)
|
||||
- [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension)
|
||||
- [Java Global Exception Handler](http://www.baeldung.com/java-global-exception-handler)
|
||||
- [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream)
|
||||
- [How to Get the Size of an Object in Java](http://www.baeldung.com/java-size-of-object)
|
||||
- [Guide to Java Instrumentation](http://www.baeldung.com/java-instrumentation)
|
||||
- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type)
|
||||
- [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions)
|
||||
- [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception)
|
||||
- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing)
|
||||
- [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties)
|
||||
- [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures)
|
||||
- [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string)
|
||||
- [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root)
|
||||
- [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string)
|
||||
- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset)
|
||||
- [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties)
|
||||
- [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format)
|
||||
- [Changing the Order in a Sum Operation Can Produce Different Results?](https://www.baeldung.com/java-floating-point-sum-order)
|
||||
- [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources)
|
||||
- [Abstract Classes in Java](https://www.baeldung.com/java-abstract-class)
|
||||
- [Guide to Character Encoding](https://www.baeldung.com/java-char-encoding)
|
||||
|
@ -24,11 +24,6 @@
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>${bouncycastle.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.unix4j</groupId>
|
||||
<artifactId>unix4j-command</artifactId>
|
||||
@ -75,12 +70,6 @@
|
||||
<version>${assertj-core.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${commons-codec.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javamoney</groupId>
|
||||
<artifactId>moneta</artifactId>
|
||||
@ -126,17 +115,6 @@
|
||||
<artifactId>h2</artifactId>
|
||||
<version>${h2database.version}</version>
|
||||
</dependency>
|
||||
<!-- Mime Type Resolution Libraries -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tika</groupId>
|
||||
<artifactId>tika-core</artifactId>
|
||||
<version>${tika.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.jmimemagic</groupId>
|
||||
<artifactId>jmimemagic</artifactId>
|
||||
<version>${jmime-magic.version}</version>
|
||||
</dependency>
|
||||
<!-- instrumentation -->
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
@ -477,8 +455,6 @@
|
||||
|
||||
<!-- util -->
|
||||
<commons-lang3.version>3.5</commons-lang3.version>
|
||||
<bouncycastle.version>1.55</bouncycastle.version>
|
||||
<commons-codec.version>1.10</commons-codec.version>
|
||||
<commons-io.version>2.5</commons-io.version>
|
||||
<commons-math3.version>3.6.1</commons-math3.version>
|
||||
<decimal4j.version>1.0.3</decimal4j.version>
|
||||
@ -509,9 +485,6 @@
|
||||
<spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version>
|
||||
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
|
||||
<icu4j.version>61.1</icu4j.version>
|
||||
<!-- Mime Type Libraries -->
|
||||
<tika.version>1.18</tika.version>
|
||||
<jmime-magic.version>0.1.5</jmime-magic.version>
|
||||
<!-- instrumentation -->
|
||||
<javaassist.version>3.21.0-GA</javaassist.version>
|
||||
|
||||
|
@ -18,4 +18,3 @@
|
||||
- [Hamcrest Text Matchers](http://www.baeldung.com/hamcrest-text-matchers)
|
||||
- [Quick Guide to the Guava RateLimiter](http://www.baeldung.com/guava-rate-limiter)
|
||||
- [Hamcrest File Matchers](https://www.baeldung.com/hamcrest-file-matchers)
|
||||
- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java)
|
||||
|
@ -7,10 +7,10 @@
|
||||
<name>mustache</name>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@ -31,6 +31,11 @@
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mustache</artifactId>
|
||||
|
@ -0,0 +1 @@
|
||||
spring.mustache.suffix:.html
|
@ -17,6 +17,7 @@
|
||||
- [Spring Data – CrudRepository save() Method](https://www.baeldung.com/spring-data-crud-repository-save)
|
||||
- [Limiting Query Results with JPA and Spring Data JPA](https://www.baeldung.com/jpa-limit-query-results)
|
||||
- [Sorting Query Results with Spring Data](https://www.baeldung.com/spring-data-sorting)
|
||||
- [INSERT Statement in JPA](https://www.baeldung.com/jpa-insert)
|
||||
|
||||
### Eclipse Config
|
||||
After importing the project into Eclipse, you may see the following error:
|
||||
|
2
pom.xml
2
pom.xml
@ -383,6 +383,7 @@
|
||||
<module>core-java-concurrency-basic</module>
|
||||
<module>core-java-concurrency-collections</module>
|
||||
<module>core-java-io</module>
|
||||
<module>core-java-security</module>
|
||||
<module>core-java-lang-syntax</module>
|
||||
<module>core-java-lang</module>
|
||||
<module>core-java-lang-oop</module>
|
||||
@ -1095,6 +1096,7 @@
|
||||
<module>core-java-concurrency-basic</module>
|
||||
<module>core-java-concurrency-collections</module>
|
||||
<module>core-java-io</module>
|
||||
<module>core-java-security</module>
|
||||
<module>core-java-lang-syntax</module>
|
||||
<module>core-java-lang</module>
|
||||
<module>core-java-lang-oop</module>
|
||||
|
@ -8,10 +8,10 @@
|
||||
<name>spring-amqp-simple</name>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -35,7 +35,7 @@ public class SpringAmqpConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
SimpleMessageListenerContainer container(ConnectionFactory connectionFactory,
|
||||
SimpleMessageListenerContainer springAmqpContainer(ConnectionFactory connectionFactory,
|
||||
MessageListenerAdapter listenerAdapter) {
|
||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
|
||||
container.setConnectionFactory(connectionFactory);
|
||||
|
@ -61,7 +61,7 @@ public class BroadcastConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SimpleRabbitListenerContainerFactory container(ConnectionFactory connectionFactory, SimpleRabbitListenerContainerFactoryConfigurer configurer) {
|
||||
public SimpleRabbitListenerContainerFactory broadcastContainer(ConnectionFactory connectionFactory, SimpleRabbitListenerContainerFactoryConfigurer configurer) {
|
||||
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
|
||||
configurer.configure(factory, connectionFactory);
|
||||
return factory;
|
||||
|
@ -9,7 +9,7 @@ import com.baeldung.springamqpsimple.SpringAmqpApplication;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SpringAmqpApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextManualTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
5
spring-amqp-simple/src/test/resources/application.yaml
Normal file
5
spring-amqp-simple/src/test/resources/application.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
spring:
|
||||
rabbitmq:
|
||||
username: guest
|
||||
password: guest
|
||||
host: localhost
|
@ -6,10 +6,10 @@
|
||||
<name>spring-aop</name>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -66,4 +66,8 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<start-class>com.baeldung.springbootsecurity.basic_auth.SpringBootSecurityApplication</start-class>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
@ -5,10 +5,10 @@ import java.util.Map;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
@ -5,10 +5,10 @@ import java.util.Map;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.NotBlank;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
@ -45,10 +45,10 @@ public class EmployeeControllerIntegrationTest {
|
||||
@Test
|
||||
public void whenPostEmployee_thenCreateEmployee() throws Exception {
|
||||
Employee alex = new Employee("alex");
|
||||
given(service.save(Mockito.anyObject())).willReturn(alex);
|
||||
given(service.save(Mockito.any())).willReturn(alex);
|
||||
|
||||
mvc.perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON).content(JsonUtil.toJson(alex))).andExpect(status().isCreated()).andExpect(jsonPath("$.name", is("alex")));
|
||||
verify(service, VerificationModeFactory.times(1)).save(Mockito.anyObject());
|
||||
verify(service, VerificationModeFactory.times(1)).save(Mockito.any());
|
||||
reset(service);
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -5,10 +5,10 @@
|
||||
<name>spring-jooq</name>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@ -129,6 +129,9 @@
|
||||
<packageName>com.baeldung.jooq.introduction.db</packageName>
|
||||
<directory>src/main/java</directory>
|
||||
</target>
|
||||
<database>
|
||||
<inputCatalog></inputCatalog>
|
||||
</database>
|
||||
</generator>
|
||||
</configuration>
|
||||
</execution>
|
||||
@ -185,14 +188,12 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<properties>
|
||||
<org.jooq.version>3.8.6</org.jooq.version>
|
||||
<org.jooq.version>3.11.7</org.jooq.version>
|
||||
<com.h2database.version>1.4.193</com.h2database.version>
|
||||
<org.springframework.version>4.3.17.RELEASE</org.springframework.version>
|
||||
|
||||
<lifecycle-mapping.version>1.0.0</lifecycle-mapping.version>
|
||||
<sql-maven-plugin.version>1.5</sql-maven-plugin.version>
|
||||
<properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
|
||||
<spring-boot.version>1.5.13.RELEASE</spring-boot.version>
|
||||
<start-class>org.jooq.example.spring.Application</start-class>
|
||||
</properties>
|
||||
|
||||
|
@ -8,10 +8,10 @@
|
||||
<description>Intro to Kafka with Spring</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@ -30,7 +30,6 @@
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
@ -102,7 +102,7 @@ public class KafkaApplication {
|
||||
}
|
||||
|
||||
public void sendMessageToPartion(String message, int partition) {
|
||||
kafkaTemplate.send(partionedTopicName, partition, message);
|
||||
kafkaTemplate.send(partionedTopicName, partition, null, message);
|
||||
}
|
||||
|
||||
public void sendMessageToFiltered(String message) {
|
||||
@ -124,13 +124,13 @@ public class KafkaApplication {
|
||||
|
||||
private CountDownLatch greetingLatch = new CountDownLatch(1);
|
||||
|
||||
@KafkaListener(topics = "${message.topic.name}", group = "foo", containerFactory = "fooKafkaListenerContainerFactory")
|
||||
@KafkaListener(topics = "${message.topic.name}", groupId = "foo", containerFactory = "fooKafkaListenerContainerFactory")
|
||||
public void listenGroupFoo(String message) {
|
||||
System.out.println("Received Messasge in group 'foo': " + message);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@KafkaListener(topics = "${message.topic.name}", group = "bar", containerFactory = "barKafkaListenerContainerFactory")
|
||||
@KafkaListener(topics = "${message.topic.name}", groupId = "bar", containerFactory = "barKafkaListenerContainerFactory")
|
||||
public void listenGroupBar(String message) {
|
||||
System.out.println("Received Messasge in group 'bar': " + message);
|
||||
latch.countDown();
|
||||
|
@ -9,7 +9,7 @@ import com.baeldung.spring.kafka.KafkaApplication;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = KafkaApplication.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextManualTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
@ -11,10 +11,10 @@
|
||||
<description>Injecting Mockito Mocks into Spring Beans</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -11,7 +11,7 @@ import org.springframework.context.annotation.Profile;
|
||||
public class NameServiceTestConfiguration {
|
||||
@Bean
|
||||
@Primary
|
||||
public NameService nameService() {
|
||||
public NameService nameServiceTest() {
|
||||
return Mockito.mock(NameService.class);
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@
|
||||
<name>spring-protobuf</name>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@ -36,21 +36,10 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<protobuf-java.version>3.1.0</protobuf-java.version>
|
||||
<protobuf-java-format.version>1.4</protobuf-java-format.version>
|
||||
<start-class>com.baeldung.protobuf.Application</start-class>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
@ -1,23 +1,29 @@
|
||||
package com.baeldung.protobuf;
|
||||
|
||||
import com.baeldung.protobuf.BaeldungTraining.Course;
|
||||
import com.baeldung.protobuf.BaeldungTraining.Student;
|
||||
import com.baeldung.protobuf.BaeldungTraining.Student.PhoneNumber;
|
||||
import com.baeldung.protobuf.BaeldungTraining.Student.PhoneType;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.baeldung.protobuf.BaeldungTraining.Course;
|
||||
import com.baeldung.protobuf.BaeldungTraining.Student;
|
||||
import com.baeldung.protobuf.BaeldungTraining.Student.PhoneNumber;
|
||||
import com.baeldung.protobuf.BaeldungTraining.Student.PhoneType;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
RestTemplate restTemplate(ProtobufHttpMessageConverter hmc) {
|
||||
return new RestTemplate(Arrays.asList(hmc));
|
||||
|
@ -16,12 +16,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.baeldung.protobuf.BaeldungTraining.Course;
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
|
||||
@DirtiesContext
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT)
|
||||
public class ApplicationIntegrationTest {
|
||||
|
@ -3,10 +3,12 @@ package org.baeldung;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.protobuf.Application;
|
||||
|
||||
@DirtiesContext
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Application.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
|
@ -11,10 +11,10 @@
|
||||
<description>Demo project for Scheduling in Spring with Quartz</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -9,10 +9,10 @@
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@ -27,7 +27,12 @@
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-bus</artifactId>
|
||||
<version>2.0.8.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-core</artifactId>
|
||||
<version>2.0.8.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,14 +1,16 @@
|
||||
package com.baeldung.controller;
|
||||
|
||||
import com.baeldung.doman.NotificationData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.baeldung.doman.NotificationData;
|
||||
|
||||
import reactor.bus.Event;
|
||||
import reactor.bus.EventBus;
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
public class NotificationController {
|
||||
|
||||
@Autowired
|
||||
|
@ -7,13 +7,14 @@
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>spring-remoting</name>
|
||||
<description>Parent for all projects related to Spring Remoting.</description>
|
||||
<description>Parent for all projects related to Spring Remoting, except remoting-hessian-burlap</description>
|
||||
<!-- remoting-hessian-burlap needs to stick to spring-boot-1, some classes were removed in spring 5 -->
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencyManagement>
|
||||
@ -28,8 +29,8 @@
|
||||
</dependencyManagement>
|
||||
|
||||
<modules>
|
||||
<module>remoting-http</module>
|
||||
<module>remoting-hessian-burlap</module>
|
||||
<module>remoting-http</module>
|
||||
<module>remoting-amqp</module>
|
||||
<module>remoting-jms</module>
|
||||
<module>remoting-rmi</module>
|
||||
|
@ -9,7 +9,7 @@ import com.baeldung.server.AmqpServer;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = AmqpServer.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextManualTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
@ -6,11 +6,13 @@
|
||||
<artifactId>remoting-hessian-burlap</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>remoting-hessian-burlap</name>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<artifactId>spring-remoting</artifactId>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-1</relativePath>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@ -9,7 +9,7 @@ import com.baeldung.server.JmsServer;
|
||||
|
||||
@SpringBootTest(classes = JmsServer.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextManualTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
@ -9,7 +9,7 @@ import com.baeldung.client.RmiClient;
|
||||
|
||||
@SpringBootTest(classes = RmiClient.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
public class SpringContextIntegrationTest {
|
||||
public class SpringContextLiveTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
@ -9,10 +9,10 @@
|
||||
<name>spring-sleuth</name>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -8,10 +8,10 @@
|
||||
<description>A demo project with vertx spring integration</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -1,4 +1,5 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<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>
|
||||
|
||||
@ -9,10 +10,10 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-1</relativePath>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
@ -38,11 +39,22 @@
|
||||
|
||||
<properties>
|
||||
<!-- Spring -->
|
||||
<spring-cloud.version>1.2.7.RELEASE</spring-cloud.version>
|
||||
<spring-cloud.version>2.1.0.RC3</spring-cloud.version>
|
||||
<!-- util -->
|
||||
<commons-lang3.version>3.5</commons-lang3.version>
|
||||
<!-- Maven plugins -->
|
||||
<maven-war-plugin.version>2.6</maven-war-plugin.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>http://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
</project>
|
@ -2,7 +2,7 @@ package org.baeldung.config;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ResourceServerApplication extends SpringBootServletInitializer {
|
||||
|
@ -3,11 +3,11 @@ package org.baeldung.config;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
@ComponentScan({ "org.baeldung.web.controller" })
|
||||
public class ResourceServerWebConfig extends WebMvcConfigurerAdapter {
|
||||
public class ResourceServerWebConfig implements WebMvcConfigurer {
|
||||
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
server.contextPath=/spring-zuul-foos-resource
|
||||
server.servlet.context-path=/spring-zuul-foos-resource
|
||||
server.port=8081
|
@ -15,7 +15,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-zuul</artifactId>
|
||||
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-netflix-core</artifactId> <version>1.0.4.RELEASE</version> </dependency> -->
|
||||
|
@ -2,7 +2,7 @@ package org.baeldung.config;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
|
||||
|
||||
@EnableZuulProxy
|
||||
|
@ -7,11 +7,11 @@ import org.springframework.web.servlet.config.annotation.DefaultServletHandlerCo
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
public class UiWebConfig extends WebMvcConfigurerAdapter {
|
||||
public class UiWebConfig implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
||||
@ -25,7 +25,6 @@ public class UiWebConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void addViewControllers(final ViewControllerRegistry registry) {
|
||||
super.addViewControllers(registry);
|
||||
registry.addViewController("/").setViewName("forward:/index");
|
||||
registry.addViewController("/index");
|
||||
registry.addViewController("/login");
|
||||
|
Loading…
x
Reference in New Issue
Block a user