Browse Source

Sigo sin conseguir anñadir Required, El resto me va bien

master
vigliom 1 year ago
parent
commit
95ddf417ad
5 changed files with 56 additions and 21 deletions
  1. +19
    -11
      .idea/workspace.xml
  2. +21
    -6
      README.md
  3. +2
    -2
      src/main/java/com/jorpelu/ServicioDeProductos/Main.java
  4. +9
    -1
      src/main/java/com/jorpelu/ServicioDeProductos/ProductoService.java
  5. +5
    -1
      src/main/resources/beans.xml

+ 19
- 11
.idea/workspace.xml View File

@ -4,17 +4,11 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="d0e2ddd8-efdc-4dce-b0fd-07c7411e37c2" name="Changes" comment="Actualizo README.md">
<change afterPath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/ISercicioProductoDAO.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/ProductoService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/ProductosDaoImplMemory.java" afterDir="false" />
<list default="true" id="d0e2ddd8-efdc-4dce-b0fd-07c7411e37c2" name="Changes" comment="Intento añadir anotaciones, pero no me deja entrar al namespace">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" /> <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/ISercicioProducto.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/Main.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/Producto.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/Producto.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/ServicioProductos.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/ProductoService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/jorpelu/ServicioDeProductos/ProductoService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/beans.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/beans.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/resources/beans.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/beans.xml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -28,6 +22,7 @@
<option value="spring-beans.schema" /> <option value="spring-beans.schema" />
<option value="Interface" /> <option value="Interface" />
<option value="Class" /> <option value="Class" />
<option value="AnnotationType" />
</list> </list>
</option> </option>
</component> </component>
@ -65,6 +60,11 @@
"spring.configuration.checksum": "ded2ef21d2f7ddd4afc5d55389ed18eb" "spring.configuration.checksum": "ded2ef21d2f7ddd4afc5d55389ed18eb"
} }
}]]></component> }]]></component>
<component name="RecentsManager">
<key name="CreateClassDialog.RecentsKey">
<recent name="com.jorpelu.ServicioDeProductos" />
</key>
</component>
<component name="RunManager"> <component name="RunManager">
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> <configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.jorpelu.ServicioDeProductos.Main" /> <option name="MAIN_CLASS_NAME" value="com.jorpelu.ServicioDeProductos.Main" />
@ -100,7 +100,7 @@
<workItem from="1669327599329" duration="2673000" /> <workItem from="1669327599329" duration="2673000" />
<workItem from="1669370939836" duration="5274000" /> <workItem from="1669370939836" duration="5274000" />
<workItem from="1669388229176" duration="732000" /> <workItem from="1669388229176" duration="732000" />
<workItem from="1669403092395" duration="6461000" />
<workItem from="1669403092395" duration="7671000" />
</task> </task>
<task id="LOCAL-00001" summary="innnit"> <task id="LOCAL-00001" summary="innnit">
<created>1669371969480</created> <created>1669371969480</created>
@ -130,7 +130,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1669374391386</updated> <updated>1669374391386</updated>
</task> </task>
<option name="localTasksCounter" value="5" />
<task id="LOCAL-00005" summary="Intento añadir anotaciones, pero no me deja entrar al namespace">
<created>1669411595874</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1669411595874</updated>
</task>
<option name="localTasksCounter" value="6" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -152,6 +159,7 @@
<MESSAGE value="Actualizo README.md borro Saludator.java" /> <MESSAGE value="Actualizo README.md borro Saludator.java" />
<MESSAGE value="Creo una interfaz para interactuar con el producto" /> <MESSAGE value="Creo una interfaz para interactuar con el producto" />
<MESSAGE value="Actualizo README.md" /> <MESSAGE value="Actualizo README.md" />
<option name="LAST_COMMIT_MESSAGE" value="Actualizo README.md" />
<MESSAGE value="Intento añadir anotaciones, pero no me deja entrar al namespace" />
<option name="LAST_COMMIT_MESSAGE" value="Intento añadir anotaciones, pero no me deja entrar al namespace" />
</component> </component>
</project> </project>

+ 21
- 6
README.md View File

@ -15,12 +15,27 @@ org.springframework id:spring-context v: 6.0.0
### Salida por pantalla ### Salida por pantalla
~~~ ~~~
id: 1
nombre: nombreProducto
descripcion: : descripcion_producto
cantidad: 100
precio: 19.99
Process finished with exit code 0
id=1
nombre='pr1'
descripcion='ds1'
cantidad=100
precio=3.2}
id=2
nombre='pr2'
descripcion='ds2'
cantidad=200
precio=3.3}
id=3
nombre='pr3'
descripcion='ds3'
cantidad=300
precio=3.4}
id=4
nombre='pr4'
descripcion='ds4'
cantidad=400
precio=3.5}
~~~ ~~~
### Explicación de la Actividad ### Explicación de la Actividad


+ 2
- 2
src/main/java/com/jorpelu/ServicioDeProductos/Main.java View File

@ -8,9 +8,9 @@ public class Main {
ApplicationContext appContext = new ClassPathXmlApplicationContext("beans.xml"); ApplicationContext appContext = new ClassPathXmlApplicationContext("beans.xml");
// ServicioProductos servicioProductos = (ServicioProductos) appContext.getBean("productosService", ServicioProductos.class); // ServicioProductos servicioProductos = (ServicioProductos) appContext.getBean("productosService", ServicioProductos.class);
ISercicioProductoDAO servicioProductos = appContext.getBean(ISercicioProductoDAO.class);
ProductoService servicioProductos = appContext.getBean(ProductoService.class);
servicioProductos.findAll().forEach(System.out::println);
servicioProductos.productoList().forEach(System.out::println);
((ClassPathXmlApplicationContext) appContext).close(); ((ClassPathXmlApplicationContext) appContext).close();
} }
} }

+ 9
- 1
src/main/java/com/jorpelu/ServicioDeProductos/ProductoService.java View File

@ -1,9 +1,17 @@
package com.jorpelu.ServicioDeProductos; package com.jorpelu.ServicioDeProductos;
import java.awt.*;
import java.util.Collection;
public class ProductoService { public class ProductoService {
private ISercicioProductoDAO productoDAO; private ISercicioProductoDAO productoDAO;
public void setProductoDAO(ISercicioProductoDAO productoDAO){
public void setProductoDAO(ISercicioProductoDAO productoDAO) {
this.productoDAO = productoDAO; this.productoDAO = productoDAO;
} }
public Collection<Producto> productoList(){
return productoDAO.findAll();
}
} }

+ 5
- 1
src/main/resources/beans.xml View File

@ -6,11 +6,15 @@
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd"> https://www.springframework.org/schema/context/spring-context.xsd">
<bean id="servicioProductos" class ="com.jorpelu.ServicioDeProductos.ProductosDaoImplMemory"
<context:annotation-config/>
<bean id="productosDaoImplMemory" class ="com.jorpelu.ServicioDeProductos.ProductosDaoImplMemory"
init-method="init"> init-method="init">
</bean> </bean>
<bean id="ProductoService" class="com.jorpelu.ServicioDeProductos.ProductoService" autowire="byType">
</bean>
<!-- <bean id="producto" class="com.jorpelu.ServicioDeProductos.Producto">--> <!-- <bean id="producto" class="com.jorpelu.ServicioDeProductos.Producto">-->
<!-- <constructor-arg index="0" value="1"/>--> <!-- <constructor-arg index="0" value="1"/>-->
<!-- <constructor-arg index="1" value="nombreProducto"/>--> <!-- <constructor-arg index="1" value="nombreProducto"/>-->


Loading…
Cancel
Save