当前位置:网站首页>Under what circumstances do you need to manually write the @bean to the container to complete the implementation class
Under what circumstances do you need to manually write the @bean to the container to complete the implementation class
2022-06-25 18:28:00 【Huang3stone】
Springboot In the project
Whenever a method is encountered, it needs to return Its corresponding implementation class when
So you need to implement this class , You use @Autowired Introduce
But after the introduction of this class not always Exist Bean In container
So write this blog post to record how to judge whether it is necessary to @Bean The introduction of
for example ( Situations that need to be manually added to the container )
This is a code about rewriting the configuration class ,
You can see endpoints.authenticationManager() This method
Need one AuthenticationManager Implementation class
How to determine whether manual operation is required @Bean Add a container ?
adopt ctrl+ left-click Enter this class 
I found that this class is No, Inject into the container , So we need to Manual Add this class to the container .
contrast ( Situations that do not require manual implementation ))
RedisTokenStore() There needs to be a RedisConnectionFactory class
ctrl+ left-click Enter this class 
You can find that this class has been injected into the container , Manual injection is not required
You can go directly through **@Autowired** It can be used after being introduced .
边栏推荐
- Basic operations and basic data types of MySQL database
- RMAN备份数据库_使用RMAN做拆分镜像(split mirror)备份
- [in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance
- RMAN backup database_ Skip offline, read-only, and inaccessible files
- C# asp,net core框架传值方式和session使用
- What is the ranking of the top ten securities companies? Is it safe to open a mobile account?
- Trample hole record -- a series of coincidences caused by thread pool rejection policy
- Redis 5.0 data structure double end linked list source code analysis
- [deeply understand tcapulusdb technology] transaction execution of document acceptance
- Batch uploading of local jar packages to nexus private server
猜你喜欢

【深入理解TcaplusDB技术】TcaplusDB业务数据备份
![[deeply understand tcapulusdb technology] one click installation of tmonitor background](/img/0a/742503e96a9b51735f5fd3f598b9af.png)
[deeply understand tcapulusdb technology] one click installation of tmonitor background
![[path planning] how to add moving objects to a path](/img/ff/2a6cc811078fa9b0f7a223f90fceac.jpg)
[path planning] how to add moving objects to a path

.NET Worker Service 添加 Serilog 日志记录

Uncover ges super large scale graph computing engine hyg: Graph Segmentation

IVX sailing

Class 02 loader subsystem

【深入理解TcaplusDB技术】如何实现Tmonitor单机安装
![[deeply understand tcapulusdb technology] create a game zone](/img/91/cf4eae9a4336ca407c0da805b9d909.png)
[deeply understand tcapulusdb technology] create a game zone
![[in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
[in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance
随机推荐
[in depth understanding of tcapulusdb technology] tcapulusdb business data backup
What is an operator?
RMAN backup database_ Duplexing backup sets
【flutter 页面跳转后退如何刷新?】
06 local method interface
Differences and relations between sequential table and array (easy to confuse), linear table and linked list
Training of long and difficult sentences in postgraduate entrance examination day83
El table highly adaptive
Training of long and difficult sentences in postgraduate entrance examination day81
LeetCode 198. Looting & dynamic planning
1. Understanding of norm
[deeply understand tcapulusdb technology] tmonitor module architecture
.NET Worker Service 如何优雅退出
What is an operator?
Interrupt operation: abortcontroller learning notes
华为云SRE确定性运维专刊(第一期)
Chapter 4:win10 installing mingw64
将Graph Explorer搬上JupyterLab:使用GES4Jupyter连接GES并进行图探索
. How to exit net worker service gracefully
JSP页面运行却显示源码