当前位置:网站首页>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)
边栏推荐
- Software testing is so hard to find, only outsourcing offers, should I go?
- Selenium browser (1)
- 金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
- [développement technologique - 24]: caractéristiques des technologies de communication Internet des objets existantes
- 又一个行业被中国芯片打破空白,难怪美国模拟芯片龙头降价抛售了
- How to use lxml to judge whether the website announcement is updated
- Unity Render Streaming通过Js与Unity自定义通讯
- Implementation of Muduo accept connection, disconnection and sending data
- page owner特性浅析
- jvm-运行时数据区
猜你喜欢

Unity embeddedbrowser browser plug-in event communication

3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)

全局事件总线

Uniapp tips - scrolling components
[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)"/>MIL-100( Fe) 包裹小分子阿司匹林形成[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)

JVM family - overview, program counter day1-1

Installation impression notes

Implementation of Muduo accept connection, disconnection and sending data

Bidirectional linked list (we only need to pay attention to insert and delete functions)

使用vscode查看Hex或UTF-8编码
随机推荐
[技術發展-24]:現有物聯網通信技術特點
[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update
3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)
GoLand 2021.1: rename the go project
MySQL 数据处理值增删改
金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
Software testing is so hard to find, only outsourcing offers, should I go?
SQL Injection (AJAX/JSON/jQuery)
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
Implementation of Muduo asynchronous logging
Conversion function and explicit
SQL Injection (POST/Search)
Golang - command line tool Cobra
Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
windos 创建cordova 提示 因为在此系统上禁止运行脚本
Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
Sequence table (implemented in C language)
[acnoi2022] guess numbers
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email






