Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.24 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5.  
  6. <groupId>it.dstech</groupId>
  7. <artifactId>MYSQLProject</artifactId>
  8. <version>0.0.1-SNAPSHOT</version>
  9. <packaging>jar</packaging>
  10.  
  11. <name>MYSQLProject</name>
  12. <description>Demo project for Spring Boot</description>
  13.  
  14. <parent>
  15. <groupId>org.springframework.boot</groupId>
  16. <artifactId>spring-boot-starter-parent</artifactId>
  17. <version>1.5.14.BUILD-SNAPSHOT</version>
  18. <relativePath/> <!-- lookup parent from repository -->
  19. </parent>
  20.  
  21. <properties>
  22. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  23. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  24. <java.version>1.8</java.version>
  25. </properties>
  26.  
  27. <dependencies>
  28. <dependency>
  29. <groupId>org.springframework.boot</groupId>
  30. <artifactId>spring-boot-starter</artifactId>
  31. </dependency>
  32.  
  33. <dependency>
  34. <groupId>org.springframework.boot</groupId>
  35. <artifactId>spring-boot-starter-test</artifactId>
  36. <scope>test</scope>
  37. </dependency>
  38. <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
  39. <dependency>
  40. <groupId>mysql</groupId>
  41. <artifactId>mysql-connector-java</artifactId>
  42. </dependency>
  43.  
  44. <dependency>
  45. <groupId>org.springframework.boot</groupId>
  46. <artifactId>spring-boot-starter-data-jpa</artifactId>
  47. </dependency>
  48. <dependency>
  49. <groupId>org.springframework.boot</groupId>
  50. <artifactId>spring-boot-starter-web</artifactId>
  51. </dependency>
  52. <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web-services -->
  53. <dependency>
  54. <groupId>org.springframework.boot</groupId>
  55. <artifactId>spring-boot-starter-web-services</artifactId>
  56. </dependency>
  57. </dependencies>
  58.  
  59. spring.datasource.driver-class-name=com.mysql.jdbc.Driver
  60. spring.datasource.url=jdbc:mysql://127.0.0.1:3306/firstproject?autoReconnect=true&useSSL=false
  61. spring.datasource.username=root
  62. spring.datasource.password=
  63.  
  64. spring.jpa.properties.hibernate.hbm2ddl.auto=update
  65. spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
  66. spring.jpa.properties.hibernate.default_schema=firstproject
  67.  
  68. package it.myprojects.FirstProject.api;
  69.  
  70. import org.springframework.beans.factory.annotation.Autowired;
  71. import org.springframework.web.bind.annotation.PathVariable;
  72. import org.springframework.web.bind.annotation.RequestBody;
  73. import org.springframework.web.bind.annotation.RequestMapping;
  74. import org.springframework.web.bind.annotation.RequestMethod;
  75. import org.springframework.web.bind.annotation.RequestParam;
  76. import org.springframework.web.bind.annotation.RestController;
  77.  
  78. import it.myprojects.FirstProject.model.Studente;
  79. import it.myprojects.FirstProject.repository.IStudenteRepository;
  80.  
  81.  
  82.  
  83. @RestController
  84. @RequestMapping(name="/studente")
  85. public class StudenteCtrl {
  86.  
  87. @Autowired
  88. private IStudenteRepository studenteRepository;
  89.  
  90. @RequestMapping(method = RequestMethod.GET, value="/findAll")
  91. public Iterable<Studente> findAll(){
  92.  
  93. return studenteRepository.findAll();
  94.  
  95. }
  96.  
  97. }
  98.  
  99. package it.myprojects.FirstProject.repository;
  100.  
  101.  
  102. import org.springframework.data.repository.CrudRepository;
  103.  
  104. import it.myprojects.FirstProject.model.Studente;
  105.  
  106. public interface IStudenteRepository extends CrudRepository<Studente, Long>{
  107.  
  108. }
  109.  
  110. package it.myprojects.FirstProject.model;
  111.  
  112.  
  113. import javax.persistence.Column;
  114. import javax.persistence.Entity;
  115. import javax.persistence.GeneratedValue;
  116. import javax.persistence.Id;
  117. import javax.persistence.SequenceGenerator;
  118.  
  119. @Entity(name= "studente")
  120. public class Studente {
  121. @Id
  122. @GeneratedValue
  123. @SequenceGenerator(name="nome_sequence", allocationSize=1, initialValue=1)
  124. private Long id;
  125.  
  126. @Column(name= "nome", unique = false, nullable = false)
  127. private String nome;
  128.  
  129. @Column(name= "cognome", nullable = false)
  130. private String cognome;
  131.  
  132. @Column(name= "matricola", unique = true, nullable = false)
  133. private String matricola;
  134.  
  135. @Column(name="codice_fiscale", unique= true, nullable=false, length=16)
  136. private String codiceFiscale;
  137.  
  138. public Long getId() {
  139. return id;
  140. }
  141. public void setId(Long id) {
  142. this.id = id;
  143. }
  144. public String getNome() {
  145. return nome;
  146. }
  147. public void setNome(String nome) {
  148. this.nome = nome;
  149. }
  150. public String getCognome() {
  151. return cognome;
  152. }
  153. public void setCognome(String cognome) {
  154. this.cognome = cognome;
  155. }
  156. public String getMatricola() {
  157. return matricola;
  158. }
  159. public void setMatricola(String matricola) {
  160. this.matricola = matricola;
  161. }
  162. public String getCodiceFiscale() {
  163. return codiceFiscale;
  164. }
  165. public void setCodiceFiscale(String codiceFiscale) {
  166. this.codiceFiscale = codiceFiscale;
  167. }
  168.  
  169.  
  170.  
  171. }
  172.  
  173. . ____ _ __ _ _
  174. /\ / ___'_ __ _ _(_)_ __ __ _
  175. ( ( )___ | '_ | '_| | '_ / _` |
  176. \/ ___)| |_)| | | | | || (_| | ) ) ) )
  177. ' |____| .__|_| |_|_| |___, | / / / /
  178. =========|_|==============|___/=/_/_/_/
  179. [32m :: Spring Boot :: [39m[2m (v1.5.14.BUILD-SNAPSHOT)[0;39m
  180.  
  181. [2m2018-06-02 19:10:44.862[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mi.m.F.MysqlProjectApplication [0;39m [2m:[0;39m Starting MysqlProjectApplication on p-Aspire-ES1-521 with PID 16533 (/home/p/Documents/workspace-sts-3.9.4.RELEASE/MYSQLProject/target/classes started by p in /home/p/Documents/workspace-sts-3.9.4.RELEASE/MYSQLProject)
  182. [2m2018-06-02 19:10:44.868[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mi.m.F.MysqlProjectApplication [0;39m [2m:[0;39m No active profile set, falling back to default profiles: default
  183. [2m2018-06-02 19:10:44.967[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mationConfigEmbeddedWebApplicationContext[0;39m [2m:[0;39m Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7f77e91b: startup date [Sat Jun 02 19:10:44 CEST 2018]; root of context hierarchy
  184. [2m2018-06-02 19:10:47.262[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mtrationDelegate$BeanPostProcessorChecker[0;39m [2m:[0;39m Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$e8fb1f3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  185. [2m2018-06-02 19:10:47.361[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36m.w.s.a.s.AnnotationActionEndpointMapping[0;39m [2m:[0;39m Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
  186. [2m2018-06-02 19:10:47.456[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mtrationDelegate$BeanPostProcessorChecker[0;39m [2m:[0;39m Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$69f7ecf4] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  187. [2m2018-06-02 19:10:48.260[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.b.c.e.t.TomcatEmbeddedServletContainer[0;39m [2m:[0;39m Tomcat initialized with port(s): 8080 (http)
  188. [2m2018-06-02 19:10:48.318[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.apache.catalina.core.StandardService [0;39m [2m:[0;39m Starting service [Tomcat]
  189. [2m2018-06-02 19:10:48.319[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36morg.apache.catalina.core.StandardEngine [0;39m [2m:[0;39m Starting Servlet Engine: Apache Tomcat/8.5.31
  190. [2m2018-06-02 19:10:48.541[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/] [0;39m [2m:[0;39m Initializing Spring embedded WebApplicationContext
  191. [2m2018-06-02 19:10:48.542[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.web.context.ContextLoader [0;39m [2m:[0;39m Root WebApplicationContext: initialization completed in 3581 ms
  192. [2m2018-06-02 19:10:48.817[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.w.servlet.ServletRegistrationBean [0;39m [2m:[0;39m Mapping servlet: 'dispatcherServlet' to [/]
  193. [2m2018-06-02 19:10:48.821[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.w.servlet.ServletRegistrationBean [0;39m [2m:[0;39m Mapping servlet: 'messageDispatcherServlet' to [/services/*]
  194. [2m2018-06-02 19:10:48.827[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.w.servlet.FilterRegistrationBean [0;39m [2m:[0;39m Mapping filter: 'characterEncodingFilter' to: [/*]
  195. [2m2018-06-02 19:10:48.828[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.w.servlet.FilterRegistrationBean [0;39m [2m:[0;39m Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
  196. [2m2018-06-02 19:10:48.829[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.w.servlet.FilterRegistrationBean [0;39m [2m:[0;39m Mapping filter: 'httpPutFormContentFilter' to: [/*]
  197. [2m2018-06-02 19:10:48.829[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ost-startStop-1][0;39m [36mo.s.b.w.servlet.FilterRegistrationBean [0;39m [2m:[0;39m Mapping filter: 'requestContextFilter' to: [/*]
  198. [2m2018-06-02 19:10:50.022[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mj.LocalContainerEntityManagerFactoryBean[0;39m [2m:[0;39m Building JPA container EntityManagerFactory for persistence unit 'default'
  199. [2m2018-06-02 19:10:50.047[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.hibernate.jpa.internal.util.LogHelper [0;39m [2m:[0;39m HHH000204: Processing PersistenceUnitInfo [
  200. name: default
  201. ...]
  202. [2m2018-06-02 19:10:50.159[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36morg.hibernate.Version [0;39m [2m:[0;39m HHH000412: Hibernate Core {5.0.12.Final}
  203. [2m2018-06-02 19:10:50.162[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36morg.hibernate.cfg.Environment [0;39m [2m:[0;39m HHH000206: hibernate.properties not found
  204. [2m2018-06-02 19:10:50.165[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36morg.hibernate.cfg.Environment [0;39m [2m:[0;39m HHH000021: Bytecode provider name : javassist
  205. [2m2018-06-02 19:10:50.240[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.hibernate.annotations.common.Version [0;39m [2m:[0;39m HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
  206. [2m2018-06-02 19:10:50.404[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36morg.hibernate.dialect.Dialect [0;39m [2m:[0;39m HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
  207. [2m2018-06-02 19:10:51.166[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36morg.hibernate.tool.hbm2ddl.SchemaUpdate [0;39m [2m:[0;39m HHH000228: Running hbm2ddl schema update
  208. [2m2018-06-02 19:10:51.278[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mj.LocalContainerEntityManagerFactoryBean[0;39m [2m:[0;39m Initialized JPA EntityManagerFactory for persistence unit 'default'
  209. [2m2018-06-02 19:10:52.408[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerAdapter[0;39m [2m:[0;39m Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7f77e91b: startup date [Sat Jun 02 19:10:44 CEST 2018]; root of context hierarchy
  210. [2m2018-06-02 19:10:52.554[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/findAll],methods=[GET]}" onto public java.lang.Iterable<it.myprojects.FirstProject.model.Studente> it.myprojects.FirstProject.api.StudenteCtrl.findAll()
  211. [2m2018-06-02 19:10:52.560[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/findOne],methods=[GET]}" onto public it.myprojects.FirstProject.model.Studente it.myprojects.FirstProject.api.StudenteCtrl.findOne(java.lang.Long)
  212. [2m2018-06-02 19:10:52.561[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/{id}/delete],methods=[GET]}" onto public void it.myprojects.FirstProject.api.StudenteCtrl.delete2(java.lang.Long)
  213. [2m2018-06-02 19:10:52.562[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/{id}/findOne],methods=[GET]}" onto public it.myprojects.FirstProject.model.Studente it.myprojects.FirstProject.api.StudenteCtrl.studenteFindOne2(java.lang.Long)
  214. [2m2018-06-02 19:10:52.563[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/delete],methods=[GET]}" onto public void it.myprojects.FirstProject.api.StudenteCtrl.delete(java.lang.Long)
  215. [2m2018-06-02 19:10:52.564[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/create],methods=[POST]}" onto public it.myprojects.FirstProject.model.Studente it.myprojects.FirstProject.api.StudenteCtrl.create(it.myprojects.FirstProject.model.Studente)
  216. [2m2018-06-02 19:10:52.571[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
  217. [2m2018-06-02 19:10:52.572[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.w.s.m.m.a.RequestMappingHandlerMapping[0;39m [2m:[0;39m Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
  218. [2m2018-06-02 19:10:52.652[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.s.w.s.handler.SimpleUrlHandlerMapping [0;39m [2m:[0;39m Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  219. [2m2018-06-02 19:10:52.653[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.s.w.s.handler.SimpleUrlHandlerMapping [0;39m [2m:[0;39m Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  220. [2m2018-06-02 19:10:52.753[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.s.w.s.handler.SimpleUrlHandlerMapping [0;39m [2m:[0;39m Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  221. [2m2018-06-02 19:10:53.373[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mo.s.j.e.a.AnnotationMBeanExporter [0;39m [2m:[0;39m Registering beans for JMX exposure on startup
  222. [2m2018-06-02 19:10:53.438[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36ms.b.c.e.t.TomcatEmbeddedServletContainer[0;39m [2m:[0;39m Tomcat started on port(s): 8080 (http)
  223. [2m2018-06-02 19:10:53.447[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[ main][0;39m [36mi.m.F.MysqlProjectApplication [0;39m [2m:[0;39m Started MysqlProjectApplication in 9.062 seconds (JVM running for 10.49)
  224. [2m2018-06-02 19:10:59.476[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.a.c.c.C.[Tomcat].[localhost].[/] [0;39m [2m:[0;39m Initializing Spring FrameworkServlet 'dispatcherServlet'
  225. [2m2018-06-02 19:10:59.477[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet [0;39m [2m:[0;39m FrameworkServlet 'dispatcherServlet': initialization started
  226. [2m2018-06-02 19:10:59.509[0;39m [32m INFO[0;39m [35m16533[0;39m [2m---[0;39m [2m[nio-8080-exec-1][0;39m [36mo.s.web.servlet.DispatcherServlet [0;39m [2m:[0;39m FrameworkServlet 'dispatcherServlet': initialization completed in 32 ms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement