YAML file is also known as streams, containing several documents, each separated by three dashes (—). create table APP_USER ( id BIGINT NOT NULL AUTO_INCREMENT, name VARCHAR(30) NOT NULL, age INTEGER NOT NULL, salary REAL NOT NULL, PRIMARY KEY (id) ); /* Populate USER Table */ INSERT INTO APP_USER(name,age,salary) VALUES ('Sam',30,70000); INSERT INTO APP_USER(name,age,salary) VALUES ('Tom',40,50000); commit; Let’s add a view to our MVC app. Spring Boot Web Mvc Auto Configuration adds Free Marker View Resolver with id ‘free Marker View Resolver’ if freemarker jar is in classpath, which is the case since we are using spring-boot-starter-freemarker. YAML is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data. For My SQL, You can run following SQL to create table and populate dummy data.In this configuration class, we are doing a lot: Creating datasource [using Hikari connection pooling], creating Entity Manager Factory, setting up transaction manager, referring to Spring-data repositories etc. My SQLDialect package com.websystique.springboot.model; import org.hibernate.validator.constraints. It provides all the CRUD operations by-default using id as the key. Logger Factory; import org.springframework.beans.factory.annotation. You can override that page, based upon the templating technology you are using.package com.websystique.springboot.configuration; import In case you need to lookup on a property other than id, you could just create a ‘camel Case’ signature with that property, spring-data will itself generate the implementation and execute the appropriate SQL to get the data out from database. Request Mapping; @Controller public class App Controller package com.websystique.springboot.controller; import For freemarker, you can create a page with name ‘error.ftl’ which would be shown in case an error occurred.Proxy Transaction Management Configuration$$Enhancer By Spring CGLIB$$e0f3dd92] is not eligible for getting processed by all Bean Post Processors (for example: not eligible for auto-proxying) 2016-12-26 .458 INFO 4496 --- [ main] s.b.c.e.t.Tomcat Embedded Servlet Container : Tomcat initialized with port(s): 8080 (http) 2016-12-26 .484 INFO 4496 --- [ main] o.apache.spring-data instead of Jpa Repository but Jpa Repository provides some goodies like paging and sorting which most of the time is needed in a FE application. Finally, Let’s run the application, firstly with ‘local’ profile [H2]. Via Eclipse:: Run it directly, in that case default profile will be used.Our controller will be using this service for all user-related operations. Service; import org.springframework.transaction.annotation. Transactional; @Service("user Service") @Transactional public class User Service Impl implements User Service package com.websystique.springboot.controller; import org.springframework.stereotype. In case you want a different profile to be used, create a Run configuration for you main class, specifying the profile.
Version : HHH000412: Hibernate Core 2016-12-26 .490 INFO 4496 --- [ main] org.Servlet Registration Bean : Mapping servlet: 'dispatcher Servlet' to [/] 2016-12-26 .037 INFO 4496 --- [ost-start Stop-1] o.s.b.w.servlet.Filter Registration Bean : Mapping filter: 'character Encoding Filter' to: [/*] 2016-12-26 .038 INFO 4496 --- [ost-start Stop-1] o.s.b.w.servlet. Data Source Properties; import org.context.properties. Configuration Properties; import org.springframework.context.annotation. Bean; import org.springframework.context.annotation. Configuration; import org.springframework.context.annotation. YAML specification is a good read to know more about them. It can be overridden by providing a bean of the same name. A line beginning with “—” may be used to explicitly denote the beginning of a new YAML document. It looks for resources in a loader path (externalized to , with empty and ‘.ftl’ defaults respectively).Annotation Config Embedded Web Application [email protected]: startup date [Mon Dec 26 CET 2016]; root of context hierarchy 2016-12-26 .422 INFO 4496 --- [ main] tration Delegate$Bean Post Processor Checker : Bean 'org.springframework.transaction.annotation.