Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1af5700
updated readme file
narasimhavuppala Dec 2, 2018
a3e75d8
Transaction management enabled
narasimhavuppala Dec 2, 2018
1934d98
updated Project documentation
narasimhavuppala Dec 2, 2018
dc4e8a8
updated Project documentation
narasimhavuppala Dec 2, 2018
f97cc5d
Application yaml
narasimhavuppala Dec 5, 2018
dd484d7
PROPERTIES FILE REPLACED WITH YML FILE
narasimhavuppala Dec 10, 2018
866a2f3
Update README.md
narasimhavuppala Jan 8, 2019
af754a2
xxxx
narasimhavuppala Jan 8, 2019
1856331
updated JSON Properties
narasimhavuppala Jan 16, 2019
0c61bf0
Merge branch 'master' of https://github.com/narasimhavuppala/Spring-b…
narasimhavuppala Jan 16, 2019
7abc121
updated with DDL.
narasimhavuppala Jan 17, 2019
b964649
fixed compilation issue
narasimhavuppala Feb 22, 2019
1a5d240
Actuator endpoints are enabled
narasimhavuppala Feb 23, 2019
9edc4ad
Endpoints are enabled
narasimhavuppala Feb 23, 2019
911d932
Hikari Connection Pool is Enabled
narasimhavuppala Feb 23, 2019
64a4792
JMS Integration to send is complete
narasimhavuppala Feb 23, 2019
1336bf8
Message consume is enabled
narasimhavuppala Feb 23, 2019
aa1d0e3
updated Readme and pom.xml dependencies are augmented with data
narasimhavuppala Feb 24, 2019
8e19e31
Bean Validation updated
narasimhavuppala Feb 24, 2019
6ef2a06
added Messaging details
narasimhavuppala Feb 24, 2019
5dc8c40
Swagger detailed are updated
narasimhavuppala Feb 24, 2019
53a37a2
updated Read me
narasimhavuppala Feb 24, 2019
67e5b99
Updated Readme
narasimhavuppala Feb 24, 2019
bf62bb7
updated Read me
narasimhavuppala Feb 24, 2019
082f654
swagger is updated
narasimhavuppala Feb 24, 2019
8e6bdc2
updated tabs
narasimhavuppala Feb 24, 2019
1e8cc4b
updated readme and other properties
narasimhavuppala Feb 24, 2019
aed0cb5
updated Read Properties
narasimhavuppala Feb 24, 2019
c08815f
updated Read me
narasimhavuppala Feb 24, 2019
a8bf972
updated configuration details
narasimhavuppala Feb 24, 2019
69e1a97
ORM details are updated
narasimhavuppala Feb 24, 2019
70fb6c1
Integrated with Oracle Database
narasimhavuppala Feb 24, 2019
0d8758d
updated model with Age. Swagger API hidden property used.
narasimhavuppala Feb 24, 2019
af713f4
update and delete functionalities are added
narasimhavuppala Feb 24, 2019
f5cd46e
update readme
narasimhavuppala Feb 24, 2019
899cc10
DSL Query and corresponding controllers are enabled
narasimhavuppala Feb 24, 2019
8a51e63
Mongo DB Integration is done
narasimhavuppala Feb 24, 2019
d24a781
unused imports are removed
narasimhavuppala Feb 24, 2019
c4f8fce
AOP integration is done
narasimhavuppala Feb 24, 2019
373e1db
Spring Security is integrated
narasimhavuppala Feb 24, 2019
1ee590b
Updated Rest Naming Standards
narasimhavuppala Apr 6, 2019
010d45d
Spring Boot Upgraded . Validation support added . Lombok added as dep…
narasimhavuppala Oct 9, 2021
e185fe4
Packages are renamed
narasimhavuppala Oct 11, 2021
33a63e7
openapi integrated
narasimhavuppala Oct 13, 2021
3f4763e
Transaction management is updated
narasimhavuppala Oct 14, 2021
817d9af
Features yet to implement are updated here
narasimhavuppala Oct 14, 2021
0f63372
Added Auditing to this project
narasimhavuppala Oct 22, 2021
081f9df
Optimized Imports
narasimhavuppala Oct 22, 2021
9d70367
OAS3 : Swagger Annotations are added
narasimhavuppala Dec 21, 2021
fc5a2bd
Global Exception Handler. Java Version updated
narasimhavuppala Jan 6, 2022
04169b9
Dockerfile is being updated
narasimhavuppala Jan 6, 2022
a8ec9fa
Create docker-image.yml
narasimhavuppala Jul 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
.sts4-cache

/*.log
.idea
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 0 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties

This file was deleted.

12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM openjdk:8-alpine
RUN mkdir -p /opt/app
ENV PROJECT_HOME /opt/app

COPY target/spring-boot-crud-rest-0.0.1-SNAPSHOT.jar $PROJECT_HOME/spring-boot-crud-rest-0.0.1-SNAPSHOT.jar

WORKDIR $PROJECT_HOME

CMD ["java" ,"-jar","./spring-boot-crud-rest-0.0.1-SNAPSHOT.jar"]


## docker build -t narasimhavuppala/spring-boot-mongo .
293 changes: 292 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,293 @@
# Spring-boot-crud-step-by-step
mvn spring-boot:run
# Pre Req
- docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.9-management
- http://localhost:15672/#/queues
- docker run -p 61616:61616 -p 8161:8161 rmohr/activemq
- Start Mongo Server
- mvn spring-boot:run

# Rest Endpoints
- Add below Dependency

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

- HTTP Methods
- GET
- Pathparam
- RequestParam
- PUT
- POST
- DELETE
- HTTP Status codes
- Mediatypes
- Produces
- Consumes
# Messaging Integration with ActiveMQ
- add below Dependency
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
- Create a seperate configuration classes


@Bean
ActiveMQConnectionFactory getActiveMQ() {
ActiveMQConnectionFactory obj = new ActiveMQConnectionFactory("username", "password", "");
obj.setBrokerURL(brokerUrl);
return obj;
}

@Bean
JmsTemplate getJmsTemplate() {
return new JmsTemplate(getActiveMQ());
}
# ORM Integration(hibenrate to Mysql/Oracle/Postgree/MS SQL/H2)
- Add below Dependency

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
- Create a model with below Annotations
- @Entity
- @Id
- Create a Repository

@Repository
public interface StudentRepository extends JpaRepository<Student, Integer> {
//Code Generation Technique: DSL
}

# Swagger
- Add dependencies in pom.xml
- Swagger API depedency & Swagger UI dependency

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>

- Add @ Bean for DocketAPI
-
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
- open url :http://localhost:port/context-path/swagger-ui.html


# Datasource creation
- @ Bean for Programatic Data Source
- Embedded will be created if you add depedency

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
- Connection Pooling
- use for Hikari: spring.datasource.type=com.zaxxer.hikari.HikariDataSource
- use the below config for Datasource

spring:
datasource:
url: jdbc:mysql://localhost:3306/mysql
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver


# Log level Details
- debug=false
- logging.file=application.log
- logging.level.org.springframework=INFO
- logging.level.org.org.hibernate=WARN


# Actuator Endpoints
- Add below Dependency in the pom.xml

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
- By default all actuator endpoints can be seen :
"http://serveropaddress:port/context-path/actuator"
- By default Endpoints are disabled due to Secure data
- enable all endpoints by : management.endpoints.web.exposure.include: "*"
- Shutdown endpoint needs to be enabled. This will not be covered in all(*)



# Spring Annotations
- @Component
- @RestController
- @RequestMapping
- @Service
- @Repository
- @SpringBootApplication
- @Bean
- @Autowired
- @Query
- @Transactional
# Dev tools
- HMR(Hot Module Replacement)

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
- Ensures Restart of Project upon save
- It does not detect the pom.xml changes
# YAML Usage
- Spring profiles active
- Server port
- Conext path : Different Application name
- usage of tab

# Reading Properties Files inside the program
- for Multiple Properties

@Autowired
Environment env;
- for single property

@Value("property.name)

# Bean Validation
- use @ Valid wherever it needs to be validated
- @NotNull
- @Email
- @Min
- @Max
- @Size
- @Past/@Future
- @Negative/@Positive
# Oracle Database connectivtity

- download JAR freom below:

https://www.oracle.com/technetwork/apps-tech/jdbc-112010-090769.html

- Install to local repo:

mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=12.1.0.1 -Dpackaging=jar
- Add pom dependency

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>12.1.0.1</version>
</dependency>
- create a user and give privilages

CREATE USER crud IDENTIFIED BY crud;

GRANT CONNECT TO crud;

GRANT CONNECT, RESOURCE, DBA TO crud;

GRANT CREATE SESSION TO crud;


GRANT UNLIMITED TABLESPACE TO crud;


- CREATE SEQUENCE student_seq
MINVALUE 1
MAXVALUE 9999999999
START WITH 4
INCREMENT BY 1;

# MongoDB Integration
- Add below dependency in pom.xml

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
- mention connection details in .yml file or(application.properties)

spring:
data:
mongodb:
host: localhost
port: 27017
database: courses
- create a mongo Repository

public interface CourseRepository extends MongoRepository<Course, String> {

}
-

# Rest Consumers
- http://www.groupkt.com/post/c9b0ccb9/country-and-other-related-rest-webservices.htm

# Open API integration
- http://localhost:8090/crudapp/swagger-ui.html
- username is : admin& admin
- yet to implement documentation Tasks

# Features Awaiting
- Exception Handling
- Controller Specific
- AOP
- Auditing...Added Auditing
- Oauth2 Integration
- password flow
- Authorization Code
- Client Credentials
- Vault Service Integration
- Spring Cloud Config Integration
- Resilient 4J integration
- CQRS integration
- Native Queries
- JDBC and Batch Support
- Spring Cloud Sleuth support
- Spring Micrometer integration
- Dockerized this app
- K8S integration
- Making external calls to the app
- Jmeter Test cases
- API Integrations
- GraphQL
- WebFlux

- Caching Using Redis and EHcache
- Open Shift Integration
# Rest
- File Upload
- Web Socket
- Encryption utilities
- Base 64 encryption
- HAL Media types
- Actuator End points
- Encrypting
- Custom Logging: Specifying the logger
- Many to Many mapping
- two data sources in the same project
- Unit Test cases
- Spring AOP

- Before
- After
- Around


Loading