ITeye博客

SpringBoot

共 11 篇文章

报错Error executing DDL via JDBC Statement

使用SpringDataJPA总是创建hibernate_sequence表 [main] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect [main] DEBUG org.hibernate.SQL - create table hibernate_sequence (next_val bigint) type=MyISAM Hibernate: create table hibernate_sequence (next_val bigint)…

2019-02-17 12:22 · SpringBoot

报错The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more t

mysql的时区错误问题: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persist…

2019-02-17 12:22 · SpringBoot

报错Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not se

WARN 12992 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/spring…

2019-02-17 12:22 · SpringBoot

pom.xml报错<failOnMissingWebXml> is set to true

[code="报错"] pom.xml报错 is set to true [/code] [code="解决方案"] 在pom.xml中增加如下代码: org.apache.maven.plugins maven-war-plugin 2.6 false [/code]

2019-02-15 13:47 · SpringBoot

SpringBoot切面AOP

[size=medium][b]1. SpringBoot切面AOP[/b][/size] [code="说明"] SpringBoot提供了强大AOP支持,这里补充说明AOP原介绍; AOP切面主要是切方法,我们一般搞一些日志分析和事务操作,要用到切面,类似拦截器; @Aspect注解是切面注解类 @Pointcut切点定义 @Before是方法执行前调用 @After是方法执行后调用 @AfterReturning方法执行返回值调用 Service层本身就可以切入事务,所以我们这类搞个常用的 切controller层方法 每个执行controller层的方法 都记录下请求Url,访问者I…

2019-02-15 09:40 · SpringBoot

SpringBoot表单验证

[size=medium][b]1. SpringBoot表单验证@Valid[/b][/size] [code="java"] 新建项目SpringDataValid src/main/resources/application.properties server.port=8000 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/springboot spring.datasource.username=root spri…

2019-02-15 09:36 · SpringBoot

SpringBoot事务管理

[size=medium][b]1. SpringBoot之事物管理@Transactional[/b][/size] [size=smaill][b]1) 正常业务[/b][/size] [code="java"] 新建项目SpringDataTransaction src/main/java/com/andrew/entity/Account.java package com.andrew.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.G…

2019-02-15 09:28 · SpringBoot

SpringBoot支持Spring Data Jpa

[size=medium][b]1. Spring Data Jpa简介[/b][/size] [code="说明"] JPA(Java Persistence API)定义了一系列对象持久化的标准,目前实现这一规范的产品有Hibernate、TopLink等。 SpringDataJPA框架,主要针对的就是Spring唯一没有简化到的业务逻辑代码,至此,开发者连仅剩的实现持久层业务逻辑的工作都省了,唯一要做的,就只是声明持久层的接口,其他都交给SpringDataJPA来帮你完成! [/code] [size=medium][b]2. Spring Data Jpa基本crud实现[/b]…

2019-02-15 09:10 · SpringBoot

SpringBoot支持MVC

[size=medium][b]1) @RequestMapping配置url映射[/b][/size] [size=medium][b]2) @Controller处理http请求[/b][/size] [code="说明"] 在pom.xml中添加Freemarker支持 pom.xml org.springframework.boot spring-boot-starter-freemarker [/code] [code="java"] src/main/java/com/andrew/controller/HelloWorldFreemarkerController.java pa…

2019-02-14 09:27 · SpringBoot

SpringBoot配置项目属性

[size=medium][b]1. 项目内置属性[/b][/size] [code="说明"] 配置文件application.properties可以自定义 之前的版本使用server.context-path 后面的版本使用server.servlet.context-path [/code] [code="java"] src/main/resource/com/andrew/application.properties server.port=8000 server.servlet.context-path=/HelloWorld helloWorld=spring boot \u…

2019-02-14 09:26 · SpringBoot

SpringBoot导入

[size=medium][b]1. SpringBoot简介[/b][/size] [code="说明"] Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。 1) 创建独立的Spring应用程序 2) 嵌入的Tomcat,无需部署WAR文件 3) 简化Maven配置 4) 自动配置Spring 5) 提…

2019-02-13 13:33 · SpringBoot