From fcb5ad1ec73ca8c7c6f13aad32cc78079d89c819 Mon Sep 17 00:00:00 2001 From: psavarmattas Date: Tue, 14 Jun 2022 11:45:09 +0530 Subject: [PATCH] Maven & Springboot --- IndustrialTrainingProjects/README.MD | 3 +- .../testAppMaven/.idea/.gitignore | 3 ++ .../testAppMaven/.idea/compiler.xml | 18 ++++++++ .../testAppMaven/.idea/encodings.xml | 6 +++ .../testAppMaven/.idea/jarRepositories.xml | 20 +++++++++ .../testAppMaven/.idea/misc.xml | 17 ++++++++ .../testAppMaven/pom.xml | 40 ++++++++++++++++++ .../testAppMaven/src/main/java/demo/Main.java | 14 ++++++ .../src/main/java/demo/student.java | 27 ++++++++++++ .../src/main/resources/spring.xml | 28 ++++++++++++ .../target/classes/demo/Main.class | Bin 0 -> 1003 bytes .../target/classes/demo/student.class | Bin 0 -> 827 bytes .../testAppMaven/target/classes/spring.xml | 28 ++++++++++++ 13 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 IndustrialTrainingProjects/testAppMaven/.idea/.gitignore create mode 100644 IndustrialTrainingProjects/testAppMaven/.idea/compiler.xml create mode 100644 IndustrialTrainingProjects/testAppMaven/.idea/encodings.xml create mode 100644 IndustrialTrainingProjects/testAppMaven/.idea/jarRepositories.xml create mode 100644 IndustrialTrainingProjects/testAppMaven/.idea/misc.xml create mode 100644 IndustrialTrainingProjects/testAppMaven/pom.xml create mode 100644 IndustrialTrainingProjects/testAppMaven/src/main/java/demo/Main.java create mode 100644 IndustrialTrainingProjects/testAppMaven/src/main/java/demo/student.java create mode 100644 IndustrialTrainingProjects/testAppMaven/src/main/resources/spring.xml create mode 100644 IndustrialTrainingProjects/testAppMaven/target/classes/demo/Main.class create mode 100644 IndustrialTrainingProjects/testAppMaven/target/classes/demo/student.class create mode 100644 IndustrialTrainingProjects/testAppMaven/target/classes/spring.xml diff --git a/IndustrialTrainingProjects/README.MD b/IndustrialTrainingProjects/README.MD index 6dc324e..d844076 100644 --- a/IndustrialTrainingProjects/README.MD +++ b/IndustrialTrainingProjects/README.MD @@ -25,4 +25,5 @@ if the problem still persist then create a issue or use Google/Stack Overlflow f |2 | [PrivateConSingleton.java](https://github.com/psavarmattas/Java-Projects/blob/master/IndustrialTrainingProjects/PrivateConSingleton.java) | Program to implement private constructor using the Singleton method. | |3 | [EmployeeModelClass.java](https://github.com/psavarmattas/Java-Projects/blob/master/IndustrialTrainingProjects/EmployeeModelClass.java) | Program to create Model Class, Getters, Setters and display the data. | |4 | [TwoDimensionalArraySum.java](https://github.com/psavarmattas/Java-Projects/blob/master/IndustrialTrainingProjects/TwoDimensionalArraySum.java) | Program to sum 2 two dimensional arrays forming a matrix. | -|5 | [CompoundInterestCalculator.java](https://github.com/psavarmattas/Java-Projects/blob/master/IndustrialTrainingProjects/CompoundInterestCalculator.java) | Program to calculate compound interest for the provided principle amount & time by following certain criteria. | \ No newline at end of file +|5 | [CompoundInterestCalculator.java](https://github.com/psavarmattas/Java-Projects/blob/master/IndustrialTrainingProjects/CompoundInterestCalculator.java) | Program to calculate compound interest for the provided principle amount & time by following certain criteria. | +|6 | [testAppMaven](https://github.com/psavarmattas/Java-Projects/blob/master/IndustrialTrainingProjects/testAppMaven) | Program to understand maven configs with Spring Boot Framework. | \ No newline at end of file diff --git a/IndustrialTrainingProjects/testAppMaven/.idea/.gitignore b/IndustrialTrainingProjects/testAppMaven/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/IndustrialTrainingProjects/testAppMaven/.idea/compiler.xml b/IndustrialTrainingProjects/testAppMaven/.idea/compiler.xml new file mode 100644 index 0000000..5e94358 --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IndustrialTrainingProjects/testAppMaven/.idea/encodings.xml b/IndustrialTrainingProjects/testAppMaven/.idea/encodings.xml new file mode 100644 index 0000000..63e9001 --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/IndustrialTrainingProjects/testAppMaven/.idea/jarRepositories.xml b/IndustrialTrainingProjects/testAppMaven/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/IndustrialTrainingProjects/testAppMaven/.idea/misc.xml b/IndustrialTrainingProjects/testAppMaven/.idea/misc.xml new file mode 100644 index 0000000..868de31 --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/.idea/misc.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/IndustrialTrainingProjects/testAppMaven/pom.xml b/IndustrialTrainingProjects/testAppMaven/pom.xml new file mode 100644 index 0000000..065c3cd --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + org.example + testAppMaven + 1.0-SNAPSHOT + + + 11 + 11 + + + + org.springframework.boot + spring-boot-starter-parent + 2.7.0 + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${project.parent.version} + + + + + + + org.springframework + spring-context + 5.3.20 + + + + \ No newline at end of file diff --git a/IndustrialTrainingProjects/testAppMaven/src/main/java/demo/Main.java b/IndustrialTrainingProjects/testAppMaven/src/main/java/demo/Main.java new file mode 100644 index 0000000..aa68fa4 --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/src/main/java/demo/Main.java @@ -0,0 +1,14 @@ +package demo; + +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Main { + public static void main(String[] args) { + // Getting application context and configuring class path of the xml file + AbstractApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); + student st = context.getBean(student.class); // Spring get bean method + st.studyJava(); // Calling the method studyJava from student class + System.out.println(student.getName()); // Using get name method to print the value of variable name + } +} \ No newline at end of file diff --git a/IndustrialTrainingProjects/testAppMaven/src/main/java/demo/student.java b/IndustrialTrainingProjects/testAppMaven/src/main/java/demo/student.java new file mode 100644 index 0000000..57dc72c --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/src/main/java/demo/student.java @@ -0,0 +1,27 @@ +package demo; + +import org.springframework.stereotype.Component; + +@Component //Annotation in Spring Boot +public class student { + + private static String name; // Name variable to use constructor, getter & setters + + public static String getName() { // Get Method to get the value of variable name + return name; + } + + public void setName(String name) { // Set Method to set the value of variable name + student.name = name; + } + +// Constructor method with old config in spring.xml +// public student(String name) { +// student.name = name; +// System.out.println(name); +// } + + public void studyJava(){ // Random method created to check the working of this class + System.out.println("Student is studying java"); + } +} diff --git a/IndustrialTrainingProjects/testAppMaven/src/main/resources/spring.xml b/IndustrialTrainingProjects/testAppMaven/src/main/resources/spring.xml new file mode 100644 index 0000000..e6daebc --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/src/main/resources/spring.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/IndustrialTrainingProjects/testAppMaven/target/classes/demo/Main.class b/IndustrialTrainingProjects/testAppMaven/target/classes/demo/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..8790885e9f6f71b039738488a7f081152054a89b GIT binary patch literal 1003 zcmbtTT~8B16g^W~mM$yQe&RQvXbaf&8?}ZAO?)sdHmPYeK25h{ySQK3ohtk+eJDl~ zzhq(dm54qnSK6|n-2H- z=Bw_$uq4CmGuyM}Hp5K0(qTx}{hrVA z?I+2k9M}=VeB&=+jlf(YW+;~5HI9kfGPJ#Zt`$vw0*B0UzN1>-_$l_^cJ4K*Dl zEE`x+9ZxGwhcC&gG_GS!!;KThwGSgHTmv_8i%j!}>*h<$X?lC-XoUNBM zL5YaUTZo5hVijdGO(6$aCw5HaNF!y*mb~>Hi#{*)|6X!!bBGxU+ Orx;xTr5{sF;K?8J822>* literal 0 HcmV?d00001 diff --git a/IndustrialTrainingProjects/testAppMaven/target/classes/demo/student.class b/IndustrialTrainingProjects/testAppMaven/target/classes/demo/student.class new file mode 100644 index 0000000000000000000000000000000000000000..1935edde87918ffd01be2f35e35acd59a90c88a5 GIT binary patch literal 827 zcmZWnU2hUW6g@+M?b5X%mRjl;YE`I-``8E6#5D22U~RQJ{7jeT>3Mq~q|- z@KlbhKv74D6sY&kpZYdcI_?UTpDL~FbAh#XXTZ`!GnN&sVIzQtb%AP6X?ZkDhBAE@ z4JSE`8AX#plqwf5lSO-?GJ(zB>O7?PVrh@^?py87<^Dbdt_3Ke%+l;{X`_9)(hXO8 zE$xXJA4e$}txVa_chcvtDA`97H$3cKaG*cWtV{yj#4Rc`Gn&y@a4QoY(*jE)WR!H* zaYtaMzwoi8vR2MZi(1aJ3hv^*hkG10x9}o3z#bZ$f9m)qTA%Q__1oXj`k%SU(%ls?{*t+X2ZR;y5RZ5|(QV)l4ZxzS literal 0 HcmV?d00001 diff --git a/IndustrialTrainingProjects/testAppMaven/target/classes/spring.xml b/IndustrialTrainingProjects/testAppMaven/target/classes/spring.xml new file mode 100644 index 0000000..e6daebc --- /dev/null +++ b/IndustrialTrainingProjects/testAppMaven/target/classes/spring.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + +