首页 > 其他分享 >how to inject <class> type in spring

how to inject <class> type in spring

时间:2023-04-19 19:07:43浏览次数:50  
标签:myproducts itemClass spring public how inject type Class


 

 

sample:

Class itemClass;

public Class getItemClass() {
return itemClass
}


public void setItemClass(Class itemClass) {
this.itemClass = itemClass;
}

 

Now inject itemClass property in spring:



<bean id="shampoo" class="com.test.Product">
<property name="itemClass">
<value type="java.lang.Class">com.myproducts.Shampoo</value>
</property>
</bean>


  

    it should work.

 

标签:myproducts,itemClass,spring,public,how,inject,type,Class
From: https://blog.51cto.com/u_6174294/6207211

相关文章

  • 【MathType】word2016数学公式编号
    问题毕业论文排版中,对数学公式需要类似(3-1)的格式。解决技巧在写论文初稿的时候,先不要于公式的编号,先给它编一个号,比如(3)(2)(4)的。最后写完了以后,再再添加section,同意修改编号格式为(章-公式序号)可以先修改mathtype章节的样式为不隐藏,这样方便添加。添加完math......
  • TypeError: super(type, obj): obj must be an instance or subtype of type这个问题
    TypeError:super(type,obj):objmustbeaninstanceorsubtypeoftype这个问题怎么处理?这个错误通常发生在使用super()函数时,第二个参数不是第一个参数的实例或子类型。在使用super()函数时,第一个参数应该是当前子类的类对象,而第二个参数应该是当前子类的实例。如果第......
  • What's PLinq? how to use it?
    What'sPLinq?howtouseit?PLinqstandsfor"ParallelLINQ",whichisaparallelimplementationofLINQ(Language-IntegratedQuery)in.NET.ItallowsdeveloperstoperformLINQqueriesinparallelbyautomaticallypartitioningtheinput......
  • ts报错:Property '$xxx' does not exist on type
    问题在catch中统一处理异常信息,就想着写到一个函数里面,然后需要用到的地方自行调用就可以。一般两种方法,要不通过mixin,要不绑定到vue的prototype上面。这里采用的是后者。在以前没引入ts之前,是那么简单的一件事情。//先绑定Vue.prototype.$catchRequestError=function(......
  • taro3 报错 TypeError: className.split is not a function
    项目原来跑的好好的,昨天升级了几个包,引用了个UI库,然后今天上班运行项目就跑不起来了,项目是在旧的项目上升级的之前的写法<Viewkey={idx}className={["tabbar-item",isActive&&"active"]}onClick={this.switchTab.bind(this,item.key)}>{......
  • 关于typescript引入第三方js文件
    一、通过require方法1.1.安装@types/node并在tsconfig.json配置,如下图所示。npmi@types/node1.2.在ts或vue中引入constvc:any=require('@/libs/VCtrl.js') 二、通过declare定义,然后import导入。2.1.在src目录下创建shims.d.ts文件。declaremodu......
  • Unable to create an object of type 'NetcoremvcDbcontext'. For the different patt
    问题描述:我整个项目重新生成没有报错,但是用efcore迁移数据库命令:Add-Migrationinit就生成不了文件夹Migrations,并且报错:Unabletocreateanobjectoftype'NetcoremvcDbcontext'.Forthedifferentpatternssupportedatdesigntime,seehttps://go.microsoft.com/fwlink/......
  • Train the Tesseract OCR engine[how to do]
    TrainingtheTesseractOCRengineisacomplexandtime-consumingprocessthatinvolvesseveralsteps.Hereisanoverviewoftheprocess:Prepareyourtrainingdata:Thisinvolvescollectingalargenumberofimagesandtheircorrespondingtext.Thete......
  • How to improve the accuracy of Tesseract OCR
    Preprocesstheimage:PreprocessinginvolvesapplyingvarioustechniquestotheimagetoenhanceitsqualityandmakeiteasierfortheOCRenginetorecognizethecharacters.Someofthepreprocessingtechniquesinclude:Binarization:Converttheimage......
  • How to fix use the cURL to connect to GitHub with a 443 HTTPS error All In One
    HowtofixusethecURLtoconnecttoGitHubwitha443HTTPSerrorAllInOne#nvm$curl-o-https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh|bashhttps://github.com/nvm-sh/nvm#installing-and-updatingerrorscurl:(7)Failedtoconnec......