当前位置:网站首页>28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
2022-07-03 13:59:00 【Small withered forest】
explain :
(1) Why did you write this blog ?:
● stay 【27: The third chapter : Developing a pass service :10:【 register / Sign in 】 Interface 】 in , We set up cookie When ,cookie Domain and path, We are all dead in the program ;
● Obviously , In the development environment 、 Test environment 、 In production environment , Our probability needs to be revised ;; meanwhile , Later in the production environment , If it may also need to be modified ;
● and , If you write this information in the code , If we want to modify , It's modified java Class ; And this is very bad ;
(2) Two solutions encountered before :
● The first way : Write the information in application.properties The configuration file of this project ( This configuration file , yes Spring Boot Project , The core application The configuration file ) in ; then , You can use @Value Annotation to get ;;; This is in 【Spring Boot Entry seven :【 In profile , Configure custom properties 】 and 【 Use @Value Annotation to get properties , To assign a value to a variable 】;】 and 【Spring Boot E-commerce projects 35: Commodity module II :【 Add goods 】 Interface picture upload :【 To upload pictures 】 Interface development ;】 in , Have a more detailed introduction ;
● The second way : We create a configuration file ( This configuration file , No Spring Boot The core configuration file for the project , It's a file we created blindly ) in ; then , Create a “ Get resource file information ” Class , Get information in the form of property files ;;; This is in 【19: The third chapter : Developing a pass service :2: In the program , Get through Alibaba cloud SMS service ;】, There is a more detailed introduction ;
(3) The approach taken by this blog is (2) The first way in ;
Catalog
One :【 Configure custom properties 】 and 【 Use @Value annotation , To get 】;
1. stay 【user】 In the user's Micro service configuration file , To set properties ;
2. stay BaseController In the code of , You can get it ;
One :【 Configure custom properties 】 and 【 Use @Value annotation , To get 】;
Statement : Prior to the start , Please be sure to quickly review : These two previous blogs ;
1. stay 【user】 In the user's Micro service configuration file , To set properties ;
2. stay BaseController In the code of , You can get it ;
explain :
(1) A special point that needs to be explained :
It can be understood in this way ,【user】 Introduced 【api】 after , Naturally, it is introduced 【api Medium BaseController】;;; Naturally at this time ,【BaseController】, You could say yes 【user】 Content in ;
3. effect ;
again install Look at the whole project , Then start 【user】 Main startup class of user microservice ; then , To register / Sign in ;(PS: In order to eliminate the previous interference , You'd better clear the browsing cookie)
边栏推荐
- Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
- [556. Next larger element III]
- SQL Injection (POST/Search)
- Multi person collaborative data annotation based on Baidu brain easydata from scratch
- The solution of Chinese font garbled code in keil5
- HALCON联合C#检测表面缺陷——HALCON例程autobahn
- Logback log sorting
- JS general form submission 1-onsubmit
- 核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
- Windos creates Cordova prompt because running scripts is prohibited on this system
猜你喜欢
Golang - command line tool Cobra
Comprehensively develop the main channel of digital economy and digital group, and actively promote the utonmos digital Tibet market
SQL Injection (AJAX/JSON/jQuery)
Richview trvstyle liststyle list style (bullet number)
jvm-类加载
Qt学习17 对话框及其类型
Failure of vector insertion element iterator in STL
[email protected] Nanoparticles) | nano metal organic framework carry"/>
Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
jvm-运行时数据区
核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
随机推荐
Use vscode to view hex or UTF-8 codes
Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:
MIL-100( Fe) 包裹小分子阿司匹林形成[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
解决MySql 1045 Access denied for user ‘root‘@‘localhost‘ (using password: YES)
MySQL 数据增删改查综合案例
Common network state detection and analysis tools
信创产业现状、分析与预测
MySQL 数据处理值增删改
Depth and breadth first traversal of tree (regardless of binary tree)
全面发展数字经济主航道 和数集团积极推动UTONMOS数藏市场
MySQL data processing value addition, deletion and modification
怎样删除对象的某个属性或⽅法
Which securities company has the lowest Commission for opening an account online? I want to open an account. Is it safe for the online account manager to open an account
Golang — template
小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。
[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心
How to promote the progress of project collaboration | community essay solicitation
QT learning 22 layout manager (I)
太阳底下无新事,元宇宙能否更上层楼?