当前位置:网站首页>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

边栏推荐
- QSS add resource file of QT
- Let's talk about the three core issues of concurrent programming.
- On some concepts involved in journal papers compilation + journal query methods
- 22-07-16 personal training match 3 competition experience
- Run file command
- Date and time function of MySQL function summary
- 2022-7-8 personal qualifying 5 competition experience (supplementary)
- BGP routing principle
- Prefix infix suffix expression (written conversion)
- Data validation typeerror: qiao Validate is not a function
猜你喜欢

小蜜蜂吉他谱 高八度和低八度

Write common API tools swagger and redoc

The second lesson is the construction of development environment

Burp suite Chapter 9 how to use burp repeater

Add in the registry right click to open in vscode

mysql函数汇总之日期和时间函数

Burp suite Chapter 7 how to use burp scanner

外卖小哥,才是这个社会最大的托底

On some concepts involved in journal papers compilation + journal query methods

Mycat2 deploy master-slave MariaDB
随机推荐
QSS add resource file of QT
[GUI] swing package (window, pop-up window, label, panel, button, list, text box)
Kotlin program control
关于期刊论文所涉及的一些概念汇编+期刊查询方法
This is a picture
JS工具函数大全
22-07-12 personal training match 1 competition experience
22-07-14 personal training match 2 competition experience
Code cloud change remote warehouse command
分享高压超低噪声LDO测试结果(High Voltage Ultra-low Noise LDO)
2022年全国职业院校技能大赛“网络安全”竞赛试题文件上传渗透测试答案Flag
2022/7/11 exam summary
Inaccurate problem of flutter fijkplayer seekto
Use of room database in kotlin
Special Lecture 3 number theory + game theory learning experience (should be updated for a long time)
Bee guitar score high octave and low octave
JS tool function Encyclopedia
2022-7-6 personal qualifying 3 competition experience
2022-7-9 personal qualifying 6 competition experience
[GUI] GUI programming; AWT package (interface properties, layout management, event monitoring)