diff --git a/blog-web/pom.xml b/blog-web/pom.xml index 8ec9481..83234be 100644 --- a/blog-web/pom.xml +++ b/blog-web/pom.xml @@ -1,64 +1,99 @@ - 4.0.0 - - codetest - com.pierceecom.sample - 1.0-SNAPSHOT - + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + blog-web + jar + blog-web - com.pierceecom.sample - blog-web - 1.0-SNAPSHOT - war + + UTF-8 + - blog-web + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-devtools + true + + + org.springframework.boot + spring-boot-starter-data-jpa + + + mysql + mysql-connector-java + + + org.projectlombok + lombok + 1.18.22 + + + org.springframework.boot + spring-boot-starter-validation + + + junit + junit + test + + + + javax + javaee-api + 8.0 + provided + - - UTF-8 - - - - - javax - javaee-api - - - junit - junit - 4.12 - test - - + + org.glassfish.jersey.core + jersey-client + test + + + org.springdoc + springdoc-openapi-ui + 1.5.0 + + org.glassfish.jersey.core jersey-client - 2.17 - test - + + org.glassfish.jersey.media + jersey-media-json-processing + + - - blog-web - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-war-plugin - 2.3 - - false - - - - - + + blog-web + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + maven-compiler-plugin + + + diff --git a/blog-web/src/main/java/com/pierceecom/blog/HelloPierceResource.java b/blog-web/src/main/java/com/pierceecom/blog/HelloPierceResource.java index ae0bcd5..cea5a61 100644 --- a/blog-web/src/main/java/com/pierceecom/blog/HelloPierceResource.java +++ b/blog-web/src/main/java/com/pierceecom/blog/HelloPierceResource.java @@ -1,16 +1,18 @@ + package com.pierceecom.blog; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -@Path("hello-pierce") +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@RequestMapping("/blog-web") public class HelloPierceResource { - @GET - @Produces(MediaType.APPLICATION_JSON) - public Response hello() { - return Response.ok("{\"message\":\"Hello Pierce\"}").build(); - } + + + @GetMapping(value = "/hello-pierce", produces = MediaType.APPLICATION_JSON_VALUE) + public Response hello() { + return Response.ok("{\"message\":\"Hello Pierce\"}").build(); + } } diff --git a/blog-web/src/main/java/com/pierceecom/blog/JAXRSConfiguration.java b/blog-web/src/main/java/com/pierceecom/blog/JAXRSConfiguration.java index 96a0744..0eabeae 100644 --- a/blog-web/src/main/java/com/pierceecom/blog/JAXRSConfiguration.java +++ b/blog-web/src/main/java/com/pierceecom/blog/JAXRSConfiguration.java @@ -1,16 +1,11 @@ -package com.pierceecom.blog; -import java.util.HashSet; -import java.util.Set; -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -@ApplicationPath("/") -public class JAXRSConfiguration extends Application { - @Override - public Set> getClasses() { - HashSet> classes = new HashSet<>(); - classes.add(HelloPierceResource.class); - return classes; - } -} + package com.pierceecom.blog; + + import java.util.HashSet; import java.util.Set; import + javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; + + @ApplicationPath("/") public class JAXRSConfiguration extends Application { + + @Override public Set> getClasses() { HashSet> classes = new + HashSet<>(); classes.add(HelloPierceResource.class); return classes; } } + \ No newline at end of file diff --git a/blog-web/src/main/java/com/pierceecom/blog/PierceSampleApplication.java b/blog-web/src/main/java/com/pierceecom/blog/PierceSampleApplication.java new file mode 100644 index 0000000..3c0110a --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/PierceSampleApplication.java @@ -0,0 +1,23 @@ +package com.pierceecom.blog; + +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; + + +@Configuration +@EnableAutoConfiguration +@SpringBootApplication +@ComponentScan +@EntityScan("com.pierceecom.blog.entity") +@EnableJpaRepositories("com.pierceecom.blog.repository") +public class PierceSampleApplication { + + public static void main(String[] args) { + SpringApplication.run(PierceSampleApplication.class, args); + } +} diff --git a/blog-web/src/main/java/com/pierceecom/blog/controller/BlogPostController.java b/blog-web/src/main/java/com/pierceecom/blog/controller/BlogPostController.java new file mode 100644 index 0000000..3cace17 --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/controller/BlogPostController.java @@ -0,0 +1,59 @@ +package com.pierceecom.blog.controller; + +import javax.validation.Valid; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +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.RestController; + +import com.pierceecom.blog.entity.BlogPost; +import com.pierceecom.blog.payload.ApiResponse; +import com.pierceecom.blog.payload.BlogPostRequest; +import com.pierceecom.blog.payload.BlogPostResponse; +import com.pierceecom.blog.service.BlogPostService; + +@RestController +@RequestMapping("/blog-web") +public class BlogPostController { + + @Autowired + BlogPostService blogPostService; + + @GetMapping(value = "/posts/getAllPosts") + public ResponseEntity getAllPosts() { + return blogPostService.getAllPosts(); + } + + @PostMapping(value = "/posts/addPost") + public BlogPostResponse addNewPost(@Valid @RequestBody BlogPostRequest newPostRequest){ + return blogPostService.addPost(newPostRequest); + } + + @GetMapping(value = "/posts/getPostById/{postId}") + public ResponseEntity findByPostId(@Valid @PathVariable String postId){ + BlogPost allPosts = blogPostService.getPost(postId); + return new ResponseEntity< >(allPosts, HttpStatus.OK); + } + + @PutMapping(value = "/posts/updatePost/{postId}") + public ResponseEntity updatePost(@Valid @RequestBody BlogPostRequest newPostRequest) { + BlogPost post = blogPostService.updatePost(newPostRequest); + + return new ResponseEntity< >(post, HttpStatus.OK); + } + + @DeleteMapping(value = "/posts/deletePost/{postId}") + public ResponseEntity deletePost(@PathVariable(name = "postId") String id) { + ApiResponse apiResponse = blogPostService.deletePost(id); + + return new ResponseEntity< >(apiResponse, HttpStatus.OK); + } +} diff --git a/blog-web/src/main/java/com/pierceecom/blog/entity/BlogPost.java b/blog-web/src/main/java/com/pierceecom/blog/entity/BlogPost.java new file mode 100644 index 0000000..ca8b50b --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/entity/BlogPost.java @@ -0,0 +1,32 @@ +package com.pierceecom.blog.entity; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.hibernate.annotations.GenericGenerator; + +import lombok.Data; + +@Entity +@Data +@Table(name = "posts") +public class BlogPost { + private static final long serialVersionUID = 1L; + + @Id + @GenericGenerator(name="posts" , strategy="increment") + @GeneratedValue(generator="posts") + private Long id; + + @Column(name = "postId", unique=true) + private String postId; + + @Column(name = "title") + private String title; + + @Column(name = "content") + private String content; +} diff --git a/blog-web/src/main/java/com/pierceecom/blog/exception/ResourceNotFoundException.java b/blog-web/src/main/java/com/pierceecom/blog/exception/ResourceNotFoundException.java new file mode 100644 index 0000000..1a42c4e --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/exception/ResourceNotFoundException.java @@ -0,0 +1,46 @@ +package com.pierceecom.blog.exception; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +import com.pierceecom.blog.payload.ApiResponse; + +@ResponseStatus(value = HttpStatus.NOT_FOUND) +public class ResourceNotFoundException extends RuntimeException { + private static final long serialVersionUID = 1L; + + private transient ApiResponse apiResponse; + + private String resourceName; + private String fieldName; + private Object fieldValue; + + public ResourceNotFoundException(String resourceName, String fieldName, Object fieldValue) { + super(); + this.resourceName = resourceName; + this.fieldName = fieldName; + this.fieldValue = fieldValue; + } + + public String getResourceName() { + return resourceName; + } + + public String getFieldName() { + return fieldName; + } + + public Object getFieldValue() { + return fieldValue; + } + + public ApiResponse getApiResponse() { + return apiResponse; + } + + private void setApiResponse() { + String message = String.format("%s not found with %s: '%s'", resourceName, fieldName, fieldValue); + + apiResponse = new ApiResponse(Boolean.FALSE, message); + } +} \ No newline at end of file diff --git a/blog-web/src/main/java/com/pierceecom/blog/implementation/BlogPostServiceImpl.java b/blog-web/src/main/java/com/pierceecom/blog/implementation/BlogPostServiceImpl.java new file mode 100644 index 0000000..ceea38b --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/implementation/BlogPostServiceImpl.java @@ -0,0 +1,76 @@ +package com.pierceecom.blog.implementation; + +import java.util.stream.Collectors; + +import javax.transaction.Transactional; +import javax.validation.Valid; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; + +import com.pierceecom.blog.entity.BlogPost; +import com.pierceecom.blog.exception.ResourceNotFoundException; +import com.pierceecom.blog.payload.ApiResponse; +import com.pierceecom.blog.payload.BlogPostRequest; +import com.pierceecom.blog.payload.BlogPostResponse; +import com.pierceecom.blog.repository.BlogRepository; +import com.pierceecom.blog.service.BlogPostService; + + +@Component +public class BlogPostServiceImpl implements BlogPostService{ + + private static final String POST = "Post"; + private static final String PostID = "id"; + + @Autowired + private BlogRepository blogPostRepository; + + @Override + public ResponseEntity getAllPosts() { + return new ResponseEntity<>(blogPostRepository.findAll().stream().collect(Collectors.toList()), HttpStatus.OK); + } + + @Override + public BlogPostResponse addPost(@Valid BlogPostRequest request) { + BlogPost blogPost = new BlogPost(); + blogPost.setPostId(request.getPostId()); + blogPost.setTitle(request.getTitle()); + blogPost.setContent(request.getContent()); + + BlogPost newPost= blogPostRepository.save(blogPost); + + BlogPostResponse postResponse= new BlogPostResponse(); + postResponse.setPostId(newPost.getPostId()); + postResponse.setTitle(newPost.getTitle()); + postResponse.setContent(newPost.getContent()); + return postResponse; + } + + + @Override + public BlogPost getPost(@Valid String postId) { + + return blogPostRepository.findByPostId(postId).orElseThrow(() -> new ResourceNotFoundException(POST, PostID, postId)); + + } + + @Override + public BlogPost updatePost(@Valid BlogPostRequest newPostRequest) { + BlogPost updatePost = blogPostRepository.findByPostId(newPostRequest.getPostId()).orElseThrow(() -> new ResourceNotFoundException(POST, PostID, newPostRequest.getPostId())); + updatePost.setTitle(newPostRequest.getTitle()); + updatePost.setContent(newPostRequest.getContent()); + return blogPostRepository.save(updatePost); + } + + @Override + @Transactional + public ApiResponse deletePost(String postId) { + blogPostRepository.findByPostId(postId).orElseThrow(() -> new ResourceNotFoundException(POST, PostID, postId)); + blogPostRepository.deleteByPostId(postId); + return new ApiResponse(Boolean.TRUE, "You successfully deleted post"); + } + +} diff --git a/blog-web/src/main/java/com/pierceecom/blog/logging/LoggingAspect.java b/blog-web/src/main/java/com/pierceecom/blog/logging/LoggingAspect.java new file mode 100644 index 0000000..74b9721 --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/logging/LoggingAspect.java @@ -0,0 +1,64 @@ +package com.pierceecom.blog.logging; + +import java.util.Arrays; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Aspect +@Component +public class LoggingAspect { + + /** + * Logging file + */ + private final Logger log = LoggerFactory.getLogger(this.getClass()); + + /** + * Pointcut that matches all repositories, services and Web REST endpoints. + */ + @Pointcut(value="execution(* com.pierceecom.blog.*.*.*(..) )") + public void springBeanPointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Advice that logs when a method is entered and exited. + * + * @param joinPoint join point for advice + * @return result + * @throws Throwable throws IllegalArgumentException + */ + @Around("springBeanPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + Object result = null; + if (log.isDebugEnabled()) { + log.debug("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs())); + } else { + log.info("Enter: {}.{}() with argument[s] = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs())); + } + try { + result = joinPoint.proceed(); + if (log.isDebugEnabled()) { + log.debug("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), result); + } else { + log.info("Exit: {}.{}() with result = {}", joinPoint.getSignature().getDeclaringTypeName(), + joinPoint.getSignature().getName(), result); + } + } catch (IllegalArgumentException e) { + log.error("Illegal argument: {} in {}.{}()", Arrays.toString(joinPoint.getArgs()), + joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), e.getMessage()); + result = e.getMessage(); + } + return result; + } + +} diff --git a/blog-web/src/main/java/com/pierceecom/blog/payload/ApiResponse.java b/blog-web/src/main/java/com/pierceecom/blog/payload/ApiResponse.java new file mode 100644 index 0000000..577b623 --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/payload/ApiResponse.java @@ -0,0 +1,46 @@ +package com.pierceecom.blog.payload; + +import java.io.Serializable; + +import org.springframework.http.HttpStatus; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import lombok.Data; + +@Data +@JsonPropertyOrder({ + "success", + "message" +}) +public class ApiResponse implements Serializable { + + @JsonIgnore + private static final long serialVersionUID = 16418120340L; + + @JsonProperty("success") + private Boolean success; + + @JsonProperty("message") + private String message; + + @JsonIgnore + private HttpStatus status; + + public ApiResponse() { + + } + + public ApiResponse(Boolean success, String message) { + this.success = success; + this.message = message; + } + + public ApiResponse(Boolean success, String message, HttpStatus httpStatus) { + this.success = success; + this.message = message; + this.status = httpStatus; + } +} \ No newline at end of file diff --git a/blog-web/src/main/java/com/pierceecom/blog/payload/BlogPostRequest.java b/blog-web/src/main/java/com/pierceecom/blog/payload/BlogPostRequest.java new file mode 100644 index 0000000..517f3ba --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/payload/BlogPostRequest.java @@ -0,0 +1,22 @@ +package com.pierceecom.blog.payload; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +import lombok.Data; + +@Data +public class BlogPostRequest { + + @NotBlank + @Size(min =5,max =12) + private String postId; + + @NotBlank + @Size(min = 5,max =20) + private String title; + + @NotBlank + @Size(min = 10,max =40) + private String content; +} diff --git a/blog-web/src/main/java/com/pierceecom/blog/payload/BlogPostResponse.java b/blog-web/src/main/java/com/pierceecom/blog/payload/BlogPostResponse.java new file mode 100644 index 0000000..2bdefde --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/payload/BlogPostResponse.java @@ -0,0 +1,11 @@ +package com.pierceecom.blog.payload; + +import lombok.Data; + +@Data +public class BlogPostResponse { + + private String postId; + private String title; + private String content; +} diff --git a/blog-web/src/main/java/com/pierceecom/blog/repository/BlogRepository.java b/blog-web/src/main/java/com/pierceecom/blog/repository/BlogRepository.java new file mode 100644 index 0000000..5bbe3d8 --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/repository/BlogRepository.java @@ -0,0 +1,22 @@ +package com.pierceecom.blog.repository; + + +import java.util.Optional; + +import javax.validation.Valid; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.pierceecom.blog.entity.BlogPost; + +@Repository +public interface BlogRepository extends JpaRepository{ + + Optional findByPostId(@Valid String PostId); + + void deleteByPostId(@Valid String id); + + +} + diff --git a/blog-web/src/main/java/com/pierceecom/blog/service/BlogPostService.java b/blog-web/src/main/java/com/pierceecom/blog/service/BlogPostService.java new file mode 100644 index 0000000..fdf2948 --- /dev/null +++ b/blog-web/src/main/java/com/pierceecom/blog/service/BlogPostService.java @@ -0,0 +1,30 @@ +package com.pierceecom.blog.service; + +import javax.validation.Valid; + +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Service; + +import com.pierceecom.blog.entity.BlogPost; +import com.pierceecom.blog.payload.ApiResponse; +import com.pierceecom.blog.payload.BlogPostRequest; +import com.pierceecom.blog.payload.BlogPostResponse; + +@Service +public interface BlogPostService { + + ResponseEntity getAllPosts(); + + BlogPostResponse addPost(@Valid BlogPostRequest request); + + //updatePost + BlogPost updatePost(@Valid BlogPostRequest newPostRequest); + + //getPostById + BlogPost getPost(String postId); + + //deletePost + ApiResponse deletePost(String postId); + + +} diff --git a/blog-web/src/main/resources/application-dev.properties b/blog-web/src/main/resources/application-dev.properties new file mode 100644 index 0000000..5993da2 --- /dev/null +++ b/blog-web/src/main/resources/application-dev.properties @@ -0,0 +1,24 @@ +## +server.port=8080 + +## MySQL +spring.datasource.url=jdbc:mysql://localhost:3306/blogdb +spring.datasource.username=root +spring.datasource.password=mysql +spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver +spring.datasource.initialization-mode=always +spring.datasource.platform=mysql + + +####### JPA Properties ###### +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLInnoDBDialect +spring.jpa.generate-ddl = true +spring.jpa.show-sql = true +spring.jpa.hibernate.ddl-auto=update + +logging.level.root=info +logging.file.name=BlogLog.log +logging.file.path=C:\Users\HP\Downloads\logfile + +#springdoc - openapi +springdoc.swagger-ui.path=/swagger-ui.html diff --git a/blog-web/src/main/resources/application.properties b/blog-web/src/main/resources/application.properties new file mode 100644 index 0000000..ae13c6c --- /dev/null +++ b/blog-web/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active= dev \ No newline at end of file diff --git a/blog-web/src/test/java/com/pierceecom/blog/HelloPierceResourceTest.java b/blog-web/src/test/java/com/pierceecom/blog/HelloPierceResourceTest.java index 2228475..4243c31 100644 --- a/blog-web/src/test/java/com/pierceecom/blog/HelloPierceResourceTest.java +++ b/blog-web/src/test/java/com/pierceecom/blog/HelloPierceResourceTest.java @@ -1,22 +1,18 @@ -package com.pierceecom.blog; -import javax.ws.rs.core.Response; -import org.junit.Test; -import static org.junit.Assert.*; - -public class HelloPierceResourceTest { - - HelloPierceResource resource; - - public HelloPierceResourceTest() { - resource = new HelloPierceResource(); - } - - @Test - public void testHello() { - Response helloResponse = resource.hello(); - String hello = (String)helloResponse.getEntity(); - assertEquals("{\"message\":\"Hello Pierce\"}", hello); - } - -} + package com.pierceecom.blog; + + import javax.ws.rs.core.Response; import org.junit.Test; import static + org.junit.Assert.*; + + public class HelloPierceResourceTest { + + HelloPierceResource resource; + + public HelloPierceResourceTest() { resource = new HelloPierceResource(); } + + @Test public void testHello() { Response helloResponse = resource.hello(); + String hello = (String)helloResponse.getEntity(); + assertEquals("{\"message\":\"Hello Pierce\"}", hello); } + + } + \ No newline at end of file diff --git a/blog-web/target/classes/META-INF/MANIFEST.MF b/blog-web/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..69a87e9 --- /dev/null +++ b/blog-web/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Build-Jdk-Spec: 17 +Implementation-Title: blog-web +Implementation-Version: 2.3.1.RELEASE +Implementation-Vendor: Pivotal Software, Inc. +Created-By: Maven Integration for Eclipse + diff --git a/blog-web/target/classes/META-INF/maven/org.springframework.boot/blog-web/pom.properties b/blog-web/target/classes/META-INF/maven/org.springframework.boot/blog-web/pom.properties new file mode 100644 index 0000000..12cff95 --- /dev/null +++ b/blog-web/target/classes/META-INF/maven/org.springframework.boot/blog-web/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Mon Feb 21 23:49:58 IST 2022 +m2e.projectLocation=C\:\\Users\\HP\\git\\codetest\\blog-web +m2e.projectName=blog-web +groupId=org.springframework.boot +artifactId=blog-web +version=2.3.1.RELEASE diff --git a/blog-web/target/classes/META-INF/maven/org.springframework.boot/blog-web/pom.xml b/blog-web/target/classes/META-INF/maven/org.springframework.boot/blog-web/pom.xml new file mode 100644 index 0000000..83234be --- /dev/null +++ b/blog-web/target/classes/META-INF/maven/org.springframework.boot/blog-web/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + blog-web + jar + blog-web + + + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-devtools + true + + + org.springframework.boot + spring-boot-starter-data-jpa + + + mysql + mysql-connector-java + + + org.projectlombok + lombok + 1.18.22 + + + org.springframework.boot + spring-boot-starter-validation + + + junit + junit + test + + + + javax + javaee-api + 8.0 + provided + + + + org.glassfish.jersey.core + jersey-client + test + + + org.springdoc + springdoc-openapi-ui + 1.5.0 + + + org.glassfish.jersey.core + jersey-client + + + org.glassfish.jersey.media + jersey-media-json-processing + + + + + blog-web + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + maven-compiler-plugin + + + + + diff --git a/blog-web/target/classes/application-dev.properties b/blog-web/target/classes/application-dev.properties new file mode 100644 index 0000000..5993da2 --- /dev/null +++ b/blog-web/target/classes/application-dev.properties @@ -0,0 +1,24 @@ +## +server.port=8080 + +## MySQL +spring.datasource.url=jdbc:mysql://localhost:3306/blogdb +spring.datasource.username=root +spring.datasource.password=mysql +spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver +spring.datasource.initialization-mode=always +spring.datasource.platform=mysql + + +####### JPA Properties ###### +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLInnoDBDialect +spring.jpa.generate-ddl = true +spring.jpa.show-sql = true +spring.jpa.hibernate.ddl-auto=update + +logging.level.root=info +logging.file.name=BlogLog.log +logging.file.path=C:\Users\HP\Downloads\logfile + +#springdoc - openapi +springdoc.swagger-ui.path=/swagger-ui.html diff --git a/blog-web/target/classes/application.properties b/blog-web/target/classes/application.properties new file mode 100644 index 0000000..ae13c6c --- /dev/null +++ b/blog-web/target/classes/application.properties @@ -0,0 +1 @@ +spring.profiles.active= dev \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3f90edd..c83542d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,38 +1,47 @@ 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + com.pierceecom.sample codetest 1.0-SNAPSHOT pom - UTF-8 - 1.8 - 1.8 + 11 - javax - javaee-api - 7.0 - provided - + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.8 - 1.8 - - + org.springframework.boot + spring-boot-maven-plugin + + true + + + + maven-compiler-plugin +