Cov txheej txheem:
Video: Kuv yuav ua li cas thiaj tsim tau qhov kev sib txuas database hauv lub caij nplooj ntoos hlav?
2024 Tus sau: Lynn Donovan | [email protected]. Kawg hloov kho: 2023-12-15 23:47
Txhawm rau nkag mus rau Relational Database los ntawm kev siv JdbcTemplate hauv Caij nplooj ntoos hlav Boot daim ntawv thov, peb yuav tsum tau ntxiv cov Caij nplooj ntoos hlav Boot Starter JDBC nyob ntawm peb tsim configuration file. Tom qab ntawd, yog tias koj @Autowired chav kawm JdbcTemplate, Caij nplooj ntoos hlav Boot yeej txuas cov Database thiab teev cov Datasource rau cov khoom JdbcTemplate.
Nyob rau hauv txoj kev no, lub caij nplooj ntoos hlav khau raj txuas rau sab nraud database li cas?
Hloov kho lub Caij Nplooj Ntoos Hlav Project Ib kauj ruam los ntawm kauj ruam
- Kauj ruam 1 - Ntxiv ib qho kev vam khom rau koj cov ntaub ntawv txuas rau pom. xml.
- Kauj Ruam 2 - Tshem tawm H2 Dependency Los ntawm pom.xml. Los yog tsawg kawg ua nws qhov kev xeem raws li kev sim.
- Kauj ruam 3 - Teeb Koj MySQL Database.
- Kauj ruam 4 - Configure koj kev twb kev txuas rau koj Database.
- Kauj ruam 5 - Rov pib dua thiab koj npaj txhij!
Ib yam li ntawd, koj tsim cov ntaub ntawv li cas? Txhawm rau tsim cov ntaub ntawv tshiab:
- Hauv Start tab, nyem Teeb Cov Ntaub Ntawv Source.
- Hauv lub npe teb, ntaus lub npe ntawm cov ntaub ntawv tshiab.
- Qhia meej hom ntawm cov ntaub ntawv qhov chaw.
- Hloov kho qhov txuas URL.
- Ntaus tus username thiab password uas muab kev nkag mus rau cov ntaub ntawv qhov chaw.
Khaws qhov no hauv kev xav, dab tsi yog lub caij nplooj ntoos hlav datasource?
A datasource yog lub Hoobkas rau kev sib txuas rau txhua lub cev cov ntaub ntawv qhov chaw . Lwm txoj hauv kev rau DriverManager chaw. Nws siv qhov URL nrog rau qee cov ntawv pov thawj los tsim kom muaj kev sib txuas ntawm cov ntaub ntawv. Ib yam khoom uas siv javax. sql ua.
JPA yog dab tsi thaum caij nplooj ntoos hlav?
JPA (Java Persistent API) yog lub hnub tshwj xeeb rau cov khoom txuas ntxiv hauv daim ntawv thov kev lag luam. Tam sim no nws yog siv los hloov cov noob taum complex.
Pom zoo:
Cron kev qhia yog dab tsi nyob rau lub caij nplooj ntoos hlav?
Ib qho Cron qhia muaj rau qhov ua ntu zus - thib ob, feeb, teev, hnub ntawm lub hli, hli, hnub (s) ntawm lub lim tiam.thiab tau tshaj tawm raws li hauv qab no @Scheduled(cron = '* * * * **')
Kuv yuav ua li cas pab SSL thaum caij nplooj ntoos hlav khau raj?
Kauj ruam 1: Tau txais daim ntawv pov thawj SSL. Yog tias koj xav siv SSL thiab ua haujlwm rau koj daim ntawv thov Spring Boot hla HTTPS koj yuav tsum tau txais daim ntawv pov thawj. Kauj ruam 2: Qhib HTTPS hauv Spring Boot. Los ntawm lub neej ntawd koj lub caij nplooj ntoos hlav khau raj embedded Tomcat thawv yuav muaj HTTP ntawm chaw nres nkoj 8080 enabled. Kauj ruam 3: Redirect HTTP rau HTTPS (yeem)
Yuav ua li cas tshem tawm lub caij nplooj ntoos hlav app?
Nov yog qhov koj tuaj yeem thim koj qhov kev tso npe Caij nplooj ntoos hlav: Qhib App Store app ntawm koj lub xov tooj (tsis yog lub caij nplooj ntoos hlav app - qhov no yog lub cim xiav hauv koj lub iPhone). Lub App Store app yuav tsum qhib rau 'Hnub no' tab. Coj mus rhaub cov hloov Account icon nyob rau sab xis saum toj. Coj mus rhaub "Manage Subscriptions." Hauv qhov ntawd koj yuav tsum pom Spring Running hais
Yuav ua li cas koj ua lub caij nplooj ntoos hlav khau?
Hauv qab no yog cov kauj ruam los tsim ib qho yooj yim Spring Boot Project. Kauj ruam 1: Qhib lub caij nplooj ntoos hlav initializr https://start.spring.io. Kauj Ruam 2: Muab cov pab pawg thiab cov khoom kos npe. Kauj ruam 3: Tam sim no nyem rau ntawm Tsim khawm. Kauj ruam 4: Extract cov ntaub ntawv RAR. Kauj ruam 5: Import lub nplaub tshev. SpringBootExampleApplication.java. pom xml
Yuav ua li cas txuas hibernate nrog caij nplooj ntoos hlav?
Cia peb pom dab tsi yog cov kauj ruam yooj yim rau hibernate thiab caij nplooj ntoos hlav kev koom ua ke: tsim cov lus hauv cov ntaub ntawv Nws yog xaiv tau. tsim applicationContext. xml cov ntaub ntawv Nws muaj cov ntaub ntawv ntawm DataSource, SessionFactory thiab lwm yam. tsim Cov Neeg Ua Haujlwm. tsim cov neeg ua haujlwm. tsim EmployeeDao. tsim InsertTest