一、最简pom:
(springboot版本2.0.x)
1.springboot的:
spring-boot-starter
spring-boot-starter-web
spring-boot-starter-test(非必需)
2.spring data jpa的:
spring-boot-starter-jpa
3.mysql的:
mysql-connector-java
其他的话还有<parent></parent>和<plugin></plugin>
----
二、application.properties中主要配置mysql和jpa(数据源),暂时没用模板先不配springmvc,
1.mysql包括:
spring.datasource.driver-class-name=
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
2.jpa包括:
spring.jpa.database=
spring.jpa.show-sql=
spring.jpa.hibernate.ddl-auto=
spring.jpa.properties.hibernate.dialect=
----
三、dao层使用Interface XxDao extends CrudRepository,不用HibernateTemplate/sessionFactory注入
----
四、SpringBoot入口类只使用一个@SpringBootApplication注解即可,不用其他注解,但一定要放在root package下。
这点参考:https://stackoverflow.com/questions/48935864/spring-boot-scan-whole-packages-without-entityscan-enablejparepositories
关于@SpringBootApplication注解参考:https://blog.csdn.net/claram/article/details/75125749