当前位置:网站首页>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)
边栏推荐
- 小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。
- QT learning 17 dialog box and its types
- Nucleic acid modified metal organic framework drug carrier | pcn-223 metal organic framework encapsulated ad adamantane | zif-8 encapsulated adriamycin (DOX)
- 信创产业现状、分析与预测
- 又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了
- 金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
- Qt学习25 布局管理器(四)
- MySQL 数据增删改查综合案例
- Use vscode to view hex or UTF-8 codes
- 项目协作的进度如何推进| 社区征文
猜你喜欢
3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
信创产业现状、分析与预测
掌握Cypress命令行选项,是真正掌握Cypress的基础
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
Qt学习24 布局管理器(三)
HALCON联合C#检测表面缺陷——HALCON例程autobahn
Dlopen() implements dynamic loading of third-party libraries
Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
MySQL data processing value addition, deletion and modification
Go language unit test 4: go language uses gomonkey to test functions or methods
随机推荐
Qt学习22 布局管理器(一)
Replace the GPU card number when pytorch loads the historical model, map_ Location settings
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
Disruptor -- a high concurrency and high performance queue framework for processing tens of millions of levels
Uniapp tips - scrolling components
Dynamic programming 01 knapsack and complete knapsack
Golang — template
mysql中的字段问题
Implementation of Muduo asynchronous logging
IBEM mathematical formula detection data set
Thrift threadmanager and three monitors
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)
Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
Qt学习25 布局管理器(四)
Heap structure and heap sort heapify
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
QT learning 17 dialog box and its types
Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:
FPGA测试方法以Mentor工具为例