Merge pull request #9462 from sampada07/JAVA-913
JAVA-913: Migrate parent-boot-1 articles to parent-boot-2
This commit is contained in:
commit
94f4acbe39
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-boot-1</artifactId>
|
<artifactId>parent-boot-2</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../../parent-boot-1</relativePath>
|
<relativePath>../../parent-boot-2</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -35,6 +35,11 @@
|
|||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.bytebuddy</groupId>
|
||||||
|
<artifactId>byte-buddy-dep</artifactId>
|
||||||
|
<version>${bytebuddy.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
@ -55,8 +60,9 @@
|
|||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
|
<spring-cloud-dependencies.version>Hoxton.SR4</spring-cloud-dependencies.version>
|
||||||
<postgresql.version>9.4-1201-jdbc4</postgresql.version>
|
<postgresql.version>42.2.10</postgresql.version>
|
||||||
|
<bytebuddy.version>1.10.10</bytebuddy.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -1,5 +1,7 @@
|
|||||||
package com.baeldung.spring.cloud.connectors.heroku.book;
|
package com.baeldung.spring.cloud.connectors.heroku.book;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ public class BookController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{bookId}")
|
@GetMapping("/{bookId}")
|
||||||
public Book findBook(@PathVariable Long bookId) {
|
public Optional<Book> findBook(@PathVariable Long bookId) {
|
||||||
return bookService.findBookById(bookId);
|
return bookService.findBookById(bookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.baeldung.spring.cloud.connectors.heroku.book;
|
package com.baeldung.spring.cloud.connectors.heroku.book;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
@ -15,8 +17,8 @@ public class BookService {
|
|||||||
this.bookRepository = bookRepository;
|
this.bookRepository = bookRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Book findBookById(Long bookId) {
|
public Optional<Book> findBookById(Long bookId) {
|
||||||
return bookRepository.findOne(bookId);
|
return bookRepository.findById(bookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.baeldung.spring.cloud.connectors.heroku.product;
|
package com.baeldung.spring.cloud.connectors.heroku.product;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ public class ProductController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{productId}")
|
@GetMapping("/{productId}")
|
||||||
public Product findProduct(@PathVariable Long productId) {
|
public Optional<Product> findProduct(@PathVariable Long productId) {
|
||||||
return productService.findProductById(productId);
|
return productService.findProductById(productId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.baeldung.spring.cloud.connectors.heroku.product;
|
package com.baeldung.spring.cloud.connectors.heroku.product;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
@ -15,8 +17,8 @@ public class ProductService {
|
|||||||
this.productRepository = productRepository;
|
this.productRepository = productRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Product findProductById(Long productId) {
|
public Optional<Product> findProductById(Long productId) {
|
||||||
return productRepository.findOne(productId);
|
return productRepository.findById(productId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-boot-1</artifactId>
|
<artifactId>parent-boot-2</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../../parent-boot-1</relativePath>
|
<relativePath>../../parent-boot-2</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@ -40,8 +40,8 @@
|
|||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version>
|
<spring-cloud-dependencies.version>Hoxton.SR4</spring-cloud-dependencies.version>
|
||||||
<spring-cloud-task.version>1.2.2.RELEASE</spring-cloud-task.version>
|
<spring-cloud-task.version>2.2.3.RELEASE</spring-cloud-task.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -45,6 +45,13 @@
|
|||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-task-batch</artifactId>
|
<artifactId>spring-cloud-task-batch</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.bytebuddy</groupId>
|
||||||
|
<artifactId>byte-buddy-dep</artifactId>
|
||||||
|
<version>${bytebuddy.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
@ -63,6 +70,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<start-class>com.baeldung.TaskDemo</start-class>
|
<start-class>com.baeldung.TaskDemo</start-class>
|
||||||
|
<bytebuddy.version>1.10.10</bytebuddy.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:h2:mem:springcloud
|
url: jdbc:h2:mem:springcloud;DB_CLOSE_ON_EXIT=FALSE
|
||||||
username: sa
|
username: sa
|
||||||
password:
|
password:
|
||||||
jpa:
|
jpa:
|
||||||
|
@ -50,8 +50,7 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-cloud-task.version>1.2.2.RELEASE</spring-cloud-task.version>
|
<spring-cloud-deployer.version>2.3.1.RELEASE</spring-cloud-deployer.version>
|
||||||
<spring-cloud-deployer.version>1.3.0.RELEASE</spring-cloud-deployer.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user