commit 531441b4ee337efdc8255918dddaa2ccc8f368e3 Author: vigliom Date: Fri Nov 25 11:26:09 2022 +0100 innnit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9902dc5 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..7377d99 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "SHARE_PROJECT_CONFIGURATION_FILES": "true", + "WebServerToolWindowFactoryState": "false", + "node.js.detected.package.eslint": "true", + "node.js.detected.package.tslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "node.js.selected.package.tslint": "(autodetect)", + "project.structure.last.edited": "Modules", + "project.structure.proportion": "0.15", + "project.structure.side.proportion": "0.2", + "spring.configuration.checksum": "ded2ef21d2f7ddd4afc5d55389ed18eb" + } +} + + + + + + + + + + + + + + 1669234080818 + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..8feb829 --- /dev/null +++ b/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + + com.jorpelu + ServicioDeProductos + 1.0-SNAPSHOT + + + 19 + 19 + UTF-8 + + + + + org.springframework + spring-context + 6.0.0 + + + + \ No newline at end of file diff --git a/src/main/java/com/jorpelu/ServicioDeProductos/Main.java b/src/main/java/com/jorpelu/ServicioDeProductos/Main.java new file mode 100644 index 0000000..4d6cdc3 --- /dev/null +++ b/src/main/java/com/jorpelu/ServicioDeProductos/Main.java @@ -0,0 +1,17 @@ +package com.jorpelu.ServicioDeProductos; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class Main { + public static void main(String[] args) { + ApplicationContext appContext = new ClassPathXmlApplicationContext("beans.xml"); + ServicioProductos servicioProductos = (ServicioProductos) appContext.getBean("productosService", ServicioProductos.class); + System.out.println("id: " + servicioProductos.getProductos().getId()); + System.out.println("nombre: " + servicioProductos.getProductos().getNombre()); + System.out.println("descripcion: : " + servicioProductos.getProductos().getDescripcion()); + System.out.println("cantidad: " + servicioProductos.getProductos().getCantidad()); + System.out.println("precio: " + servicioProductos.getProductos().getPrecio()); + ((ClassPathXmlApplicationContext) appContext).close(); + } +} \ No newline at end of file diff --git a/src/main/java/com/jorpelu/ServicioDeProductos/Producto.java b/src/main/java/com/jorpelu/ServicioDeProductos/Producto.java new file mode 100644 index 0000000..1aa318f --- /dev/null +++ b/src/main/java/com/jorpelu/ServicioDeProductos/Producto.java @@ -0,0 +1,57 @@ +package com.jorpelu.ServicioDeProductos; + +public class Producto { + private int id; + private String nombre; + private String descripcion; + private int cantidad; + private float precio; + + public Producto(int id, String nombre, String descripcion, int cantidad, float precio) { + this.id = id; + this.nombre = nombre; + this.descripcion = descripcion; + this.cantidad = cantidad; + this.precio = precio; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public String getDescripcion() { + return descripcion; + } + + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + public int getCantidad() { + return cantidad; + } + + public void setCantidad(int cantidad) { + this.cantidad = cantidad; + } + + public float getPrecio() { + return precio; + } + + public void setPrecio(float precio) { + this.precio = precio; + } +} diff --git a/src/main/java/com/jorpelu/ServicioDeProductos/Saludator.java b/src/main/java/com/jorpelu/ServicioDeProductos/Saludator.java new file mode 100644 index 0000000..89f20b2 --- /dev/null +++ b/src/main/java/com/jorpelu/ServicioDeProductos/Saludator.java @@ -0,0 +1,12 @@ +package com.jorpelu.ServicioDeProductos; + +public class Saludator { + private String mensaje; + public String saludo(){ + return (mensaje==null) ? "No se ha encontrado el mensaje... " : mensaje; + } + + public Saludator(String mensaje) { + this.mensaje = mensaje; + } +} diff --git a/src/main/java/com/jorpelu/ServicioDeProductos/ServicioProductos.java b/src/main/java/com/jorpelu/ServicioDeProductos/ServicioProductos.java new file mode 100644 index 0000000..97e62c5 --- /dev/null +++ b/src/main/java/com/jorpelu/ServicioDeProductos/ServicioProductos.java @@ -0,0 +1,15 @@ +package com.jorpelu.ServicioDeProductos; + +import java.util.ArrayList; + +public class ServicioProductos { + private Producto productos; + + public Producto getProductos() { + return productos; + } + + public void setProducto(Producto productos) { + this.productos = productos; + } +} diff --git a/src/main/resources/beans.xml b/src/main/resources/beans.xml new file mode 100644 index 0000000..e89e379 --- /dev/null +++ b/src/main/resources/beans.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file