yaml配置文件:
spring:
datasource:
username: root
password: 123456
#加入时区报错了,就增加一个时区ok了&serverTimezone=UTC&
url: jdbc:mysql://localhost:3306/blog?&serverTimezone=UTC&useUnicode=false&charactEncoding=utf-8&useSSL=false
driver-class-name: com.mysql.jdbc.Driver
jpa:
generate-ddl: true
hibernate:
ddl-auto: update
use-new-id-generator-mappings: false
show-sql: true
database: mysql
实体类
@Entity(name = "user")
public class User2{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column
private String username;
@Column
private String password;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
应用程序主入口
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@ComponentScan(basePackages = {"com.wang.*"})
@EntityScan("com.wang.pojo")
public class BlogSpringbootApplication {
public static void main(String[] args) {
SpringApplication.run(BlogSpringbootApplication.class, args);
}
}
项目结构:
求助!不知道哪里有问题?