当前位置:网站首页>23.6 23.7 web environment web environment variable reading
23.6 23.7 web environment web environment variable reading
2022-07-26 08:29:00 【csg103】
One SpringApplication Will try to create the correct type ApplicationContext . By default, it will depend on whether you are developing a web Application and use AnnotationConfigApplicationContext or AnnotationConfigEmbeddedWebApplicationContext . Decide to use web The algorithm of environment is actually very simple ( Based on the existence of several classes ), To override this default mechanism, use setWebEnvironment(boolean webEnvironment) .
in addition , It can also be taken by calling setApplicationContextClass(…) What is used ApplicationContext Type to fully control . Usually in JUnit Use in test SpringApplication Called when setWebEnvironment(false) .
Add project parameters args1 234

New registration bean
@Component public class MyBean { @Autowired public MyBean(ApplicationArguments args){ boolean debug = args.containsOption("debug"); List<String> files = args.getNonOptionArgs(); // if run with "--debug logfile.txt" debug=true, files=["logfile.txt"] } }
debug Run in mode

边栏推荐
- Differences and connections of previewkeydown, Keydown, keypress and Keyup in C WinForm
- Burp Suite - Chapter 2 burp suite proxy and browser settings
- Regular expression job
- Shell homework the next day
- import error: ‘Icon‘ is not exported from ‘antd‘. Import icon error
- Flex three column layout
- Daily Note (11) -- word formula input arbitrary matrix
- 【C语言】程序员筑基功法——《函数栈帧的创建与销毁》
- Exam summary on July 15, 2022
- vscode国内的镜像服务器加速
猜你喜欢

2022-7-5 personal qualifying 2 competition experience

The second lesson is the construction of development environment

Basic music theory rhythm connection problem, very important

A little awesome, 130000 a month+

Burp suite Chapter 8 how to use burp intruder

22-07-12 personal training match 1 competition experience

Seq2seq and attention model learning notes

Daily Note (11) -- word formula input arbitrary matrix

Apple's tough new rule: third-party payment also requires a percentage, and developers lose a lot!

Super nice navigation page (static page)
随机推荐
关于期刊论文所涉及的一些概念汇编+期刊查询方法
The first ide overlord in the universe, replaced...
vscode国内的镜像服务器加速
Kotlin operator
Dev gridcontrol 捕获按键事件
Burp suite Chapter 4 advanced options for SSL and proxy
ORACLE 官方文档
第四天作业
【EndNote】文献类型与文献类型缩写汇编
[endnote] detailed explanation of document template layout syntax
Mycat2 deploy master-slave MariaDB
A summary of practical websites that won't brighten people's eyes
Problems caused by slivereappbar
Dev gridcontrol captures key events
C# WinForm中PreviewKeyDown、KeyDown、KeyPress、KeyUp区别与联系
I am 35 years old.
Zroi easy sum (generating function, block, DP, combination, polynomial)
QT uses QSS to make a beautiful login interface (hand-in-hand teaching)
If Yi Lijing spits about programmers
苹果强硬新规:用第三方支付也要抽成,开发者亏大了!