国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

簡(jiǎn)單! springboot 項(xiàng)目,訪(fǎng)問(wèn)返回 Hello SpringBoot !

2019-11-10 22:59:30
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

sPRingboot 項(xiàng)目,訪(fǎng)問(wèn)返回 Hello SpringBoot !

準(zhǔn)備

瀏覽器jdk8uploading...

idea(自備 ide 技能均可)

新建項(xiàng)目

進(jìn)入 Spring 官網(wǎng)點(diǎn)擊 【Start a new Spring Project】直達(dá)

推薦選擇 grandle, 配置文件清爽不少

選擇如下

簡(jiǎn)單介紹

各個(gè)組件Web: 集成 SpringMVCSecurity:JPA:Actuator:Thymeleaf:MySQL:Lombok:HSQLDB:

SpringBoot 1.4.2 文檔

Idea 導(dǎo)入

解壓后到目錄下改 build.gradle 中 elipse 為 idea,這是因?yàn)槲矣玫?idea, eclipse 的話(huà)應(yīng)該不用改,不過(guò)我沒(méi)試過(guò)。然后直接在目錄下執(zhí)行

╰─$ ./gradlew idea

完成后便可以直接用 idea 打開(kāi)了

記得要 使用 import

點(diǎn)擊 Finish 完成,等ok。。。

啟動(dòng)

運(yùn)行 Daxueapplication.java

2017-01-05 09:01:27.132  WARN 53547 --- [           main] o.s.boot.SpringApplication               : Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available)2017-01-05 09:01:27.138 ERROR 53547 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : ***************************APPLICATION FAILED TO START***************************Description:Cannot determine embedded database driver class for database type NONEAction:If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

啟動(dòng)失敗,問(wèn)題是缺少數(shù)據(jù)庫(kù)配置

解決:在 application.properties 里加數(shù)據(jù)庫(kù)配置,自己在 MySQL 里新建一個(gè)數(shù)據(jù)庫(kù)。application.properties 中內(nèi)容如下:

spring.datasource.url=jdbc:mysql://localhost:3306/daxuespring.datasource.username=rootspring.datasource.passWord=123qwe# update 模式會(huì)自動(dòng)建表,有改動(dòng)后也會(huì)更新,不過(guò)不會(huì)刪原來(lái)的東西spring.jpa.properties.hibernate.hbm2ddl.auto=updatespring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialectspring.jpa.properties.hibernate.connection.release_mode=auto

OK,啟動(dòng)完畢看結(jié)果

此時(shí)目錄結(jié)構(gòu)如下

╰─$ tree -a.├── .gitignore├── .gradle│   └── 2.13│       └── taskArtifacts│           ├── cache.properties│           ├── cache.properties.lock│           ├── fileHashes.bin│           ├── fileSnapshots.bin│           └── taskArtifacts.bin├── build.gradle├── daxue.iml├── daxue.ipr├── daxue.iws├── gradle│   └── wrapper│       ├── gradle-wrapper.jar│       └── gradle-wrapper.properties├── gradlew├── gradlew.bat└── src    ├── main    │   ├── java    │   │   └── cn    │   │       └── dxs2s    │   │           ├── DaxueApplication.java    │   │           ├── domain    │   │           ├── service    │   │           └── web    │   │               └── IndexController.java    │   └── resources    │       ├── application.properties    │       ├── static    │       └── templates    └── test        └── java            └── cn                └── dxs2s                    └── DaxueApplicationTests.java

沒(méi)有 MySQL ? 木有關(guān)系,這么辦

更改一下依賴(lài)再刷新即可hslqdb 是一個(gè)內(nèi)存數(shù)據(jù)庫(kù),一般用來(lái)測(cè)試用,在使用 JPA 的方式下可以無(wú)縫切換到 MySQL。沒(méi)有 MySQL 的環(huán)境可以暫時(shí)頂用一下。

再次啟動(dòng)

訪(fǎng)問(wèn) http://localhost:8080SpringSecurity 的默認(rèn)基本安全配置,密碼請(qǐng)?jiān)趩?dòng)的日志中自行尋找。

目標(biāo)達(dá)成!


發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 从化市| 大城县| 团风县| 武定县| 象州县| 南乐县| 张家口市| 彩票| 靖宇县| 玉门市| 闻喜县| 乌兰察布市| 禄丰县| 高密市| 将乐县| 宁河县| 贵阳市| 华阴市| 万盛区| 十堰市| 万荣县| 保德县| 凤台县| 浦江县| 隆化县| 九江市| 麻栗坡县| 吉安县| 博爱县| 平原县| 正镶白旗| 朝阳市| 常州市| 崇礼县| 仁布县| 肇州县| 鹰潭市| 三明市| 安吉县| 巴林右旗| 鹰潭市|