Home > Back-end >  SpringBoot starts clearly did not automatically create a table
SpringBoot starts clearly did not automatically create a table

Time:09-26

Pom file

<? The XML version="1.0" encoding="utf-8"?>
Xsi: schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" & gt;
4.0.0 & lt;/modelVersion>

Com. Lyh
Girl
0.0.1 - SNAPSHOT
Jar

Girl
The Demo project for Spring Boot


org.springframework.boot
Spring - the boot - starter - parent
2.0.4. RELEASE



Utf-8 & lt;/project. Build. SourceEncoding>
Utf-8 & lt;/project. Reporting. OutputEncoding>
1.8 & lt;/Java. Version>




org.springframework.boot
Spring - the boot - starter - web



org.springframework.boot
Spring - the boot - starter - test
Test



org.springframework.boot
Spring - the boot - starter - data - jpa



Mysql
Mysql connector - java







org.springframework.boot
Spring - the boot - maven - plugin







Package com. Lyh. Girl;

The import org. Springframework. Boot. SpringApplication;
The import org. Springframework. Boot. Autoconfigure. SpringBootApplication;
The import org. Springframework. Boot. Autoconfigure. JDBC. DataSourceAutoConfiguration;
The import org. Springframework. Boot. Autoconfigure. Orm. Jpa. HibernateJpaAutoConfiguration;

GirlApplication class -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
@ SpringBootApplication (exclude={DataSourceAutoConfiguration. Class, HibernateJpaAutoConfiguration class})
Public class GirlApplication {

Public static void main (String [] args) {
SpringApplication. Run (GirlApplication. Class, args);
}
}
Yml file -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Spring:
Profiles:
Active: dev
Datasource:
The driver - class - name: com. Mysql.. JDBC driver
Url: JDBC: mysql://127.0.0.1:3306/dbgirl
Username: root
Password: 123456
Jpa:
Hibernate:
DDL - auto: create
The show - SQL: true


The controller class -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Package com. Lyh. Girl;

The import org. Springframework. Beans. Factory. The annotation. Autowired;
The import org. Springframework. Web. Bind. The annotation. *;

@ RestController
@ RequestMapping ("/hello! ")
Public class HelloController {

The @autowired
Private GirlProperties GirlProperties;

@ GetMapping (value="https://bbs.csdn.net/say")
Public String say () {
Return girlProperties. GetCupSize () + girlProperties. GetAge ();
}
}

CodePudding user response:

The eldest brother, later how to solve this problem

CodePudding user response:

See the log, table didn't create, could be abnormal execution process,
  • Related