Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>it.dstech</groupId>
- <artifactId>MYSQLProject</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>MYSQLProject</name>
- <description>Demo project for Spring Boot</description>
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>1.5.14.BUILD-SNAPSHOT</version>
- <relativePath/> <!-- lookup parent from repository -->
- </parent>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <java.version>1.8</java.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-data-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web-services -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web-services</artifactId>
- </dependency>
- </dependencies>
- spring.datasource.driver-class-name=com.mysql.jdbc.Driver
- spring.datasource.url=jdbc:mysql://127.0.0.1:3306/firstproject?autoReconnect=true&useSSL=false
- spring.datasource.username=root
- spring.datasource.password=
- spring.jpa.properties.hibernate.hbm2ddl.auto=update
- spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
- spring.jpa.properties.hibernate.default_schema=firstproject
- package it.myprojects.FirstProject.api;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import it.myprojects.FirstProject.model.Studente;
- import it.myprojects.FirstProject.repository.IStudenteRepository;
- @RestController
- @RequestMapping(name="/studente")
- public class StudenteCtrl {
- @Autowired
- private IStudenteRepository studenteRepository;
- @RequestMapping(method = RequestMethod.GET, value="/findAll")
- public Iterable<Studente> findAll(){
- return studenteRepository.findAll();
- }
- }
- package it.myprojects.FirstProject.repository;
- import org.springframework.data.repository.CrudRepository;
- import it.myprojects.FirstProject.model.Studente;
- public interface IStudenteRepository extends CrudRepository<Studente, Long>{
- }
- package it.myprojects.FirstProject.model;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.Id;
- import javax.persistence.SequenceGenerator;
- @Entity(name= "studente")
- public class Studente {
- @Id
- @GeneratedValue
- @SequenceGenerator(name="nome_sequence", allocationSize=1, initialValue=1)
- private Long id;
- @Column(name= "nome", unique = false, nullable = false)
- private String nome;
- @Column(name= "cognome", nullable = false)
- private String cognome;
- @Column(name= "matricola", unique = true, nullable = false)
- private String matricola;
- @Column(name="codice_fiscale", unique= true, nullable=false, length=16)
- private String codiceFiscale;
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public String getNome() {
- return nome;
- }
- public void setNome(String nome) {
- this.nome = nome;
- }
- public String getCognome() {
- return cognome;
- }
- public void setCognome(String cognome) {
- this.cognome = cognome;
- }
- public String getMatricola() {
- return matricola;
- }
- public void setMatricola(String matricola) {
- this.matricola = matricola;
- }
- public String getCodiceFiscale() {
- return codiceFiscale;
- }
- public void setCodiceFiscale(String codiceFiscale) {
- this.codiceFiscale = codiceFiscale;
- }
- }
- . ____ _ __ _ _
- /\ / ___'_ __ _ _(_)_ __ __ _
- ( ( )___ | '_ | '_| | '_ / _` |
- \/ ___)| |_)| | | | | || (_| | ) ) ) )
- ' |____| .__|_| |_|_| |___, | / / / /
- =========|_|==============|___/=/_/_/_/
- [32m :: Spring Boot :: [39m[2m (v1.5.14.BUILD-SNAPSHOT)[0;39m
- [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)
- [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
- [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
- [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)
- [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]
- [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)
- [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)
- [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]
- [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
- [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
- [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
- [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 [/]
- [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/*]
- [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: [/*]
- [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: [/*]
- [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: [/*]
- [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: [/*]
- [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'
- [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 [
- name: default
- ...]
- [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}
- [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
- [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
- [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}
- [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
- [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
- [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'
- [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
- [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()
- [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)
- [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)
- [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)
- [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)
- [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)
- [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)
- [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)
- [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]
- [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]
- [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]
- [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
- [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)
- [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)
- [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'
- [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
- [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