Commit bc04acb8 authored by aray's avatar aray

initial commit by Admin

parent d83d56b3
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaPluginProjectSettings" dtoSerializableType="1">
<option name="entityNameTemplate" value="${className}" />
<option name="isLombokGetterAndSetter" value="true" />
<option name="isLombokToString" value="true" />
<option name="isLombokBuilder" value="true" />
<option name="isLombokAllArgsConstructor" value="true" />
<option name="isLombokNoArgsConstructor" value="true" />
<option name="scaffoldingLanguage" />
</component>
</project>
\ No newline at end of file
FROM openjdk:17-alpine
ADD /target/playground-assessment-demo-0.0.1-SNAPSHOT.jar //
ENTRYPOINT ["java", "-jar", "/playground-assessment-demo-0.0.1-SNAPSHOT.jar"]
# Getting Started
# Springboot 3.0.2 with MongoDB 5.0
### Reference Documentation
For further reference, please consider the following sections:
## Overview
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.0.1/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.0.1/maven-plugin/reference/html/#build-image)
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.0.1/reference/htmlsingle/#web)
* [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/3.0.1/reference/htmlsingle/#data.nosql.mongodb)
This template is designed in-order to give you best experience to start your coding without doing any addition configuration.
### Guides
The following guides illustrate how to use some features concretely:
Candidates are requested to push your changes to remote repository as soon as possible so that respective TA/Coach can review it and provide the feedback to move you to the next level.
```
pre-requisite
```
1. Docker need to be installed in your local system to enable you to build your code locally and deploy in docker container.
````
Steps to be flowed
````
1. Implement your use-case and add Junit test case.
2. ensure that your code is running locally in local docker container.
3. Dockerfile and docker-compose files available at project root directory.[no need to make any changes in Docker/docker-compose]
````
Command :
1. mvn clean install
2. docker compose up --build
3. docker ps; // check that your container is up and running
````
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
* [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/)
version: "3"
services:
mongodbs:
image: mongo:5.0
container_name: "mongodbs"
ports:
- 27017:27017
api:
build: .
ports:
- 1099:1099
depends_on:
- mongodbs
environment:
spring.data.mongodb.host: mongodbs
......@@ -10,11 +10,11 @@
</parent>
<groupId>com.altimetrik</groupId>
<artifactId>demo</artifactId>
<artifactId>playground-assessment-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PlaygroundCandidateDemo</name>
<description>PlaygroundCandidateDemo</description>
<name>PlaygroundAssessmentDemo</name>
<description>PlaygroundAssessmentDemo</description>
<properties>
<java.version>17</java.version>
......@@ -23,11 +23,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
......@@ -35,6 +36,13 @@
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......@@ -56,6 +64,24 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.5.3.Final</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
......
package com.altimetrik.controllers;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/hello")
public class Hello {
@GetMapping(value = "/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.ALL_VALUE)
public ResponseEntity<String> getUserDetailByGitlabEmailId() {
return new ResponseEntity<>("Wecome to Playground...", HttpStatus.OK);
}
}
package com.altimetrik;
package com.altimetrik.playground.candidate.assessment;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
@SpringBootApplication
@Slf4j
public class Application {
public class PlaygroundAssessmentDemoApplication {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
log.info("Application has been successfully started..");
SpringApplication.run(PlaygroundAssessmentDemoApplication.class, args);
}
}
package com.altimetrik.playground.candidate.assessment.controller;
public class AdminDbConsoleController {
}
\ No newline at end of file
package com.altimetrik.playground.candidate.assessment.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Data
@Document(collection = "user_details")
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class UserDataEntity {
@Id
public String id;
public String firstName;
public String lastName;
}
package com.altimetrik.playground.candidate.assessment.repository;
import java.util.List;
import com.altimetrik.playground.candidate.assessment.entity.UserDataEntity;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserDataRepository extends MongoRepository<UserDataEntity, String> {
public UserDataEntity findByFirstName(String firstName);
public List<UserDataEntity> findByLastName(String lastName);
}
\ No newline at end of file
swagger.enable=true
k8s.db.env=db-config-k8s
server.servlet.contextPath=/
server.port=1099
spring.data.mongodb.host=mongodbs
# Spring properties
spring:
application:
name: PlaygroundCandidateDemo # Service registers under this name
name: PlaygroundAssessmentDemo
freemarker:
enabled: false # Ignore Eureka dashboard FreeMarker templates
enabled: false
# HTTP Server
server:
port: 1099 # HTTP (Tomcat) port
port: 1092 # HTTP (Tomcat) port
servlet.contextPath: /
undertow:
accesslog:
undertow:
accesslog:
enabled: true
# Logging configurations
......@@ -24,5 +22,6 @@ logging:
org.springframework.security: INFO
org.hibernate.SQL: WARN
article:
fileName : validator.json
\ No newline at end of file
jasypt:
encryptor:
password: playground
[
{
"id": 1,
"title": "SAMPLE APPLICATION",
"description": "It is a Sample Demo Application",
"tags": [
"JAVA",
"SPRING"
],
"vote": 1,
"createdBy": "ssa3410@altimetrik.com",
"createdDate": "01-12-2018",
"updatedBy": null,
"updatedDate": null
},
{
"id": 2,
"title": "secod APPLICATION",
"description": "It is a Sample Demo Application",
"tags": [
"JAVA",
"SPRING"
],
"vote": 2,
"createdDate": "01-12-2018",
"createdBy": "pg-ta@altimetrik.com",
"updatedDate": null,
"updatedBy": null
},
{
"id": 3,
"title": "secod APPLICATION",
"description": "It is a Sample Demo Application",
"tags": [
"JAVA",
"SPRING"
],
"vote": 0,
"createdDate": "01-12-2018",
"createdBy": "pg-ta@altimetrik.com",
"updatedDate": null,
"updatedBy": null
}
]
\ No newline at end of file
......@@ -6,8 +6,5 @@ import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ApplicationTests {
@Test
void contextLoads() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment