Skip to content
Snippets Groups Projects
Commit 27410001 authored by M2kishore's avatar M2kishore
Browse files

mysql

parent d941e3e0
No related branches found
No related tags found
No related merge requests found
......@@ -3,9 +3,6 @@ package com.example.bookmanagement;
import java.util.List;
import java.util.Optional;
import com.example.bookmanagement.error.BookIdMismatchException;
import com.example.bookmanagement.error.BookNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -13,8 +10,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
@RestController
......@@ -49,7 +44,6 @@ Optional<Book> book = bookRepository.findById(id);
Book book_new=book.get();
book_new.setAuthor_name(bookDetails.getAuthor_name());
book_new.setBook_name(bookDetails.getBook_name());
book_new.setIsbn(bookDetails.getIsbn());
return bookRepository.save(book_new);
}
......
......@@ -33,7 +33,7 @@ public class SimpleController {
@PostMapping("/")
public String checkCredentials() {
if(){
if(true){
return "Book";
}else{
return "loginError";
......
......@@ -9,6 +9,7 @@ spring.application.name=Bootstrap Spring Boot
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url = jdbc:mysql://localhost:3306/library
spring.datasource.username =root
spring.datasource.password =root
## Hibernate Properties
......
package com.example.bookmanagement;
import javax.ws.rs.core.Response;
import org.apache.tomcat.util.http.parser.MediaType;
public class SpringBootBootstrapLiveTest {
private static final String API_ROOT
= "http://localhost:8085/api/books";
private Book createRandomBook() {
Book book = new Book();
book.setTitle(randomAlphabetic(10));
book.setAuthor(randomAlphabetic(15));
return book;
}
private String createBookAsUri(Book book) {
Response response = RestAssured.given()
.contentType(MediaType.APPLICATION_JSON_VALUE)
.body(book)
.post(API_ROOT);
return API_ROOT + "/" + ((Object) response).jsonPath().get("id");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment