Disable kotlin and spring-5 (#2192)
* Disable kotlin and spring-5 * Remove spring-data-javaslang
This commit is contained in:
parent
ef34fc6576
commit
716e7c2123
5
pom.xml
5
pom.xml
|
@ -93,7 +93,7 @@
|
||||||
<module>log4j</module>
|
<module>log4j</module>
|
||||||
<module>log4j2</module>
|
<module>log4j2</module>
|
||||||
<module>lombok</module>
|
<module>lombok</module>
|
||||||
|
<!-- <module>kotlin</module>-->
|
||||||
<module>mapstruct</module>
|
<module>mapstruct</module>
|
||||||
<module>metrics</module>
|
<module>metrics</module>
|
||||||
<module>mesos-marathon</module>
|
<module>mesos-marathon</module>
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
<module>selenium-junit-testng</module>
|
<module>selenium-junit-testng</module>
|
||||||
<module>solr</module>
|
<module>solr</module>
|
||||||
<module>spark-java</module>
|
<module>spark-java</module>
|
||||||
<module>spring-5</module>
|
<!-- <module>spring-5</module>-->
|
||||||
<module>spring-5-mvc</module>
|
<module>spring-5-mvc</module>
|
||||||
<module>spring-akka</module>
|
<module>spring-akka</module>
|
||||||
<module>spring-amqp</module>
|
<module>spring-amqp</module>
|
||||||
|
@ -140,7 +140,6 @@
|
||||||
<module>spring-data-couchbase-2</module>
|
<module>spring-data-couchbase-2</module>
|
||||||
<module>spring-data-dynamodb</module>
|
<module>spring-data-dynamodb</module>
|
||||||
<module>spring-data-elasticsearch</module>
|
<module>spring-data-elasticsearch</module>
|
||||||
<module>spring-data-javaslang</module>
|
|
||||||
<module>spring-data-mongodb</module>
|
<module>spring-data-mongodb</module>
|
||||||
<module>spring-data-neo4j</module>
|
<module>spring-data-neo4j</module>
|
||||||
<module>spring-data-redis</module>
|
<module>spring-data-redis</module>
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
/target/
|
|
||||||
/project/
|
|
||||||
.idea
|
|
||||||
.classpath
|
|
||||||
.eclipse
|
|
|
@ -1,109 +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>spring-data-javaslang</groupId>
|
|
||||||
<artifactId>spring-data-javaslang</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<groovy-eclipse-compiler.version>2.9.1-01</groovy-eclipse-compiler.version>
|
|
||||||
<groovy-eclipse-batch.version>2.3.7-01</groovy-eclipse-batch.version>
|
|
||||||
<org.codehouse.groovy.version>2.4.8</org.codehouse.groovy.version>
|
|
||||||
<javaslang.version>2.0.5</javaslang.version>
|
|
||||||
<spring-boot.version>1.5.1.RELEASE</spring-boot.version>
|
|
||||||
<spring-context.version>4.3.6.RELEASE</spring-context.version>
|
|
||||||
<spring-core.version>4.3.6.RELEASE</spring-core.version>
|
|
||||||
<spring-test.version>4.3.6.RELEASE</spring-test.version>
|
|
||||||
<project.build.testSourceDirectory>${basedir}/src/test/java</project.build.testSourceDirectory>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>parent-boot-5</artifactId>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../parent-boot-5</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>test-app</id>
|
|
||||||
<build>
|
|
||||||
<defaultGoal>verify</defaultGoal>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>spring-boot-run</id>
|
|
||||||
<phase>verify</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>run</goal>
|
|
||||||
</goals>
|
|
||||||
<inherited>false</inherited>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
|
||||||
<optional>true</optional>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.h2database</groupId>
|
|
||||||
<artifactId>h2</artifactId>
|
|
||||||
<version>1.4.193</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/io.javaslang/javaslang -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.javaslang</groupId>
|
|
||||||
<artifactId>javaslang</artifactId>
|
|
||||||
<version>${javaslang.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.data</groupId>
|
|
||||||
<artifactId>spring-data-jpa</artifactId>
|
|
||||||
<version>1.11.0.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-context</artifactId>
|
|
||||||
<version>${spring-context.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-core</artifactId>
|
|
||||||
<version>${spring-core.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.baeldung.spring_data.model;
|
|
||||||
|
|
||||||
import javaslang.collection.Seq;
|
|
||||||
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.CollectionTable;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.ElementCollection;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "book")
|
|
||||||
public class Book {
|
|
||||||
|
|
||||||
@GeneratedValue
|
|
||||||
@Id
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
private Seq<String> authors;
|
|
||||||
|
|
||||||
|
|
||||||
public void setTitle(String title){
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle(){
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId(){
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthors(Seq authors){
|
|
||||||
this.authors = authors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Seq getAuthors(){
|
|
||||||
return this.authors;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
package com.baeldung.spring_data.model;
|
|
||||||
|
|
||||||
import javax.persistence.ElementCollection;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "java_book")
|
|
||||||
public class JavaBook {
|
|
||||||
|
|
||||||
@GeneratedValue
|
|
||||||
@Id
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
@ElementCollection
|
|
||||||
private List<String> authors;
|
|
||||||
|
|
||||||
|
|
||||||
public void setAuthors(List<String> authors){
|
|
||||||
this.authors = authors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title){
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle(){
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId(){
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.baeldung.spring_data.repository;
|
|
||||||
|
|
||||||
import com.baeldung.spring_data.model.Book;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import javaslang.collection.Seq;
|
|
||||||
import javaslang.control.Option;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public interface BookRepository extends JpaRepository<Book,Long>{
|
|
||||||
Book save(Book book);
|
|
||||||
|
|
||||||
Option<Book> findById(Long id);
|
|
||||||
|
|
||||||
Option<Seq<Book>> findByTitleContaining(String title);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.baeldung.spring_data.repository;
|
|
||||||
|
|
||||||
import com.baeldung.spring_data.model.JavaBook;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public interface JavaBookRepository extends JpaRepository<JavaBook,Long>{
|
|
||||||
JavaBook save(JavaBook book);
|
|
||||||
|
|
||||||
JavaBook findById(Long id);
|
|
||||||
|
|
||||||
List<JavaBook> findByTitleContaining(String title);
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package com.baeldung.spring_data_app;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableJpaRepositories("com.baeldung.spring_data.repository")
|
|
||||||
@EnableTransactionManagement
|
|
||||||
@EntityScan("com.baeldung.spring_data.model")
|
|
||||||
@SpringBootApplication
|
|
||||||
public class MainApp {
|
|
||||||
public static void main(String[] args){
|
|
||||||
SpringApplication.run(MainApp.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,89 +0,0 @@
|
||||||
package com.baeldung.spring_data_tests;
|
|
||||||
|
|
||||||
import com.baeldung.spring_data.model.Book;
|
|
||||||
import com.baeldung.spring_data.model.JavaBook;
|
|
||||||
import com.baeldung.spring_data.repository.BookRepository;
|
|
||||||
import com.baeldung.spring_data.repository.JavaBookRepository;
|
|
||||||
import com.baeldung.spring_data_app.MainApp;
|
|
||||||
import javaslang.collection.List;
|
|
||||||
import javaslang.collection.Seq;
|
|
||||||
import javaslang.control.Option;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
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.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = MainApp.class,webEnvironment = WebEnvironment.NONE)
|
|
||||||
public class SpringIntegrationTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private JavaBookRepository javaRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BookRepository repository;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void should_return_seq(){
|
|
||||||
Seq authors = List.of("author1","author2");
|
|
||||||
Book testBook = new Book();
|
|
||||||
testBook.setTitle("Javaslang in Spring Data Seq Test Return");
|
|
||||||
testBook.setAuthors(authors);
|
|
||||||
Book book = repository.save(testBook);
|
|
||||||
Option<Seq<Book>> books = repository.findByTitleContaining("Seq Test");
|
|
||||||
|
|
||||||
assertThat(books).isNotEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void should_return_option_with_book(){
|
|
||||||
Seq authors = List.of("author1","author2");
|
|
||||||
Book testBook = new Book();
|
|
||||||
testBook.setTitle("Javaslang in Spring Data");
|
|
||||||
testBook.setAuthors(authors);
|
|
||||||
Book book = repository.save(testBook);
|
|
||||||
Option<Book> retBook = repository.findById(1L);
|
|
||||||
|
|
||||||
assertThat(retBook.isDefined()).isTrue();
|
|
||||||
assertThat(retBook).isNotEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void should_return_list(){
|
|
||||||
ArrayList<String> authors = new ArrayList<String>();
|
|
||||||
authors.add("author1");
|
|
||||||
authors.add("author2");
|
|
||||||
JavaBook testBook = new JavaBook();
|
|
||||||
testBook.setTitle("Javaslang in Spring Data Seq Return");
|
|
||||||
testBook.setAuthors(authors);
|
|
||||||
JavaBook book = javaRepository.save(testBook);
|
|
||||||
java.util.List<JavaBook> books = javaRepository.findByTitleContaining("Seq");
|
|
||||||
assertThat(books)
|
|
||||||
.isNotEmpty()
|
|
||||||
.hasSize(1)
|
|
||||||
.extracting("title")
|
|
||||||
.contains("Javaslang in Spring Data Seq Return");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void should_return_book(){
|
|
||||||
ArrayList<String> authors = new ArrayList<String>();
|
|
||||||
authors.add("author1");
|
|
||||||
authors.add("author2");
|
|
||||||
JavaBook testBook = new JavaBook();
|
|
||||||
testBook.setTitle("Javaslang in Spring Data");
|
|
||||||
testBook.setAuthors(authors);
|
|
||||||
JavaBook book = javaRepository.save(testBook);
|
|
||||||
JavaBook retBook = javaRepository.findById(1L);
|
|
||||||
|
|
||||||
assertThat(retBook.getId()).isEqualTo(1L);
|
|
||||||
assertThat(retBook.getTitle()).isEqualTo("Javaslang in Spring Data");
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue