当前位置: 首页 > news >正文

没有网站怎么做链接视频网站租用 凡

没有网站怎么做链接视频,网站租用 凡,黄骅港属于哪个省哪个市,短网址生成防屏蔽Resource介绍 在Spring框架中#xff0c;Resource 注解是一个JSR-250标准注解#xff0c;用于自动装配#xff08;autowiring#xff09;Spring容器中的bean。Resource 注解可以用于字段、方法和方法参数上#xff0c;以声明依赖注入。 Resource源码 Target({TYPE, FIE…Resource介绍 在Spring框架中Resource 注解是一个JSR-250标准注解用于自动装配autowiringSpring容器中的bean。Resource 注解可以用于字段、方法和方法参数上以声明依赖注入。 Resource源码 Target({TYPE, FIELD, METHOD}) Retention(RUNTIME) Repeatable(Resources.class) public interface Resource {String name() default ;String lookup() default ;Class? type() default java.lang.Object.class;enum AuthenticationType {CONTAINER,APPLICATION}AuthenticationType authenticationType() default AuthenticationType.CONTAINER;boolean shareable() default true;String mappedName() default ;String description() default ; } 源代码截图 Resource属性介绍 name资源的JNDI名称装配指定名称的Bean。type装配指定类型的Bean。lookup引用指向的资源名称可以使用JNDI名称指向任何兼容的资源。AuthenticationType指定身份验证类型。shareable指定当前Bean是否可以在多个组件之间共享。mappedName指定资源的映射名称。description指定资源的描述。 Resource注解使用场景 数据库连接池注入在 Java 应用中数据库连接池是一个常见的资源。使用 Resource 注解可以将数据库连接池注入到需要使用数据库连接的类中。 JNDI 资源注入Java Naming and Directory InterfaceJNDI是一个应用程序设计的API为开发人员提供了查找和访问各种命名和目录服务的通用、统一的接口如DNS、LDAP、NIS、CORBA 对象服务等。使用 Resource 注解可以将 JNDI 资源注入到 JavaBean 中。 事务管理器注入在 Java 应用中事务管理器是一个重要的资源。使用 Resource 注解可以将事务管理器注入到需要进行事务管理的类中。 其他资源注入除了上述资源外Resource 注解还可以用于将其他类型的资源注入到 JavaBean 中如文件资源、网络资源等。 Resource测试示例代码 示例代码 一 ResourceDemoService类 package com.yang.SpringTest.annotation.resourceLean;/*** pResourceDemoService类/p** author By: chengxuyuanshitang* Package com.yang.SpringTest.annotation.resourceLean* Ceate Time 2024-04-12 16:23*/ public interface ResourceDemoService {void demo(); }ResourceDemoServiceAImpl类 package com.yang.SpringTest.annotation.resourceLean;import org.springframework.stereotype.Service;/*** pResourceDemoServiceAImpl类/p** author By: chengxuyuanshitang* Package com.yang.SpringTest.annotation.resourceLean* Ceate Time 2024-04-12 16:26*/ Service(resourceDemoServiceA) public class ResourceDemoServiceAImpl implements ResourceDemoService {Overridepublic void demo () {System.out.println ( ResourceDemoServiceAImpl.demo...);} } ResourceDemoServiceBImpl类 package com.yang.SpringTest.annotation.resourceLean;import org.springframework.stereotype.Service;/*** pResourceDemoServiceBImpl类/p** author By: chengxuyuanshitang* Package com.yang.SpringTest.annotation.resourceLean* Ceate Time 2024-04-12 16:26*/ Service(resourceDemoServiceB) public class ResourceDemoServiceBImpl implements ResourceDemoService {Overridepublic void demo () {System.out.println ( ResourceDemoServiceBImpl.demo...);} } ResourceDemoController类 package com.yang.SpringTest.annotation.resourceLean;import org.springframework.stereotype.Controller;import javax.annotation.Resource;/*** pResourceDemoController类/p** author By: chengxuyuanshitang* Package com.yang.SpringTest.annotation.resourceLean* Ceate Time 2024-04-12 16:27*/ Controller public class ResourceDemoController {Resource(name resourceDemoServiceB)private ResourceDemoService resourceDemoService;public void demo () {resourceDemoService.demo ();}} ResourceDemoConfig配置类 package com.yang.SpringTest.annotation.resourceLean;import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration;/*** pResourceDemoConfig配置类/p** author By: chengxuyuanshitang* Package com.yang.SpringTest.annotation.resourceLean* Ceate Time 2024-04-12 16:31*/ Configuration ComponentScan(value {com.yang.SpringTest.annotation.resourceLean}) public class ResourceDemoConfig {} ResourceDemoTest测试类 package com.yang.SpringTest.annotation.resourceLean;import org.springframework.context.annotation.AnnotationConfigApplicationContext;import java.util.Arrays;/*** pResourceDemoTest测试类/p** author By: chengxuyuanshitang* Package com.yang.SpringTest.annotation.resourceLean* Ceate Time 2024-04-12 16:32*/ public class ResourceDemoTest {public static void main (String[] args) {AnnotationConfigApplicationContext context new AnnotationConfigApplicationContext (ResourceDemoConfig.class);String[] definitionNames context.getBeanDefinitionNames ();Arrays.stream (definitionNames).forEach ((definitionName) - System.out.println (definitionName));System.out.println (--------------------);ResourceDemoController resourceDemoController context.getBean (ResourceDemoController.class);resourceDemoController.demo ();context.close ();}} 运行结果
http://www.zqtcl.cn/news/849374/

相关文章:

  • 网站地图什么意思电子商务营销推广
  • 手机排行榜网站教育平台网站开发
  • 佛山市顺德区建设局网站萧山网站建设
  • 合肥百度团购网站建设怀化网站开发
  • 网站建设ppt模板彩票网站开发dadi163
  • 网站建设4435建筑设计一般用什么软件
  • 河南网站建设重庆森林台词
  • 网站一直没收录雄安做网站
  • 全国网站直播平台被摧毁响应是网站怎么做
  • 衡阳建设网站做网站和app多少费用
  • 怎么做付费网站蚌埠网站建设专业公司哪家好
  • 学网站建设需要多长时间成都网站建设定制开发服务
  • 建站宝盒后台深圳建网站公司怎么选择
  • 什么是大型门户网站网站建设的经验之谈
  • 网站建站网站设计网站制作书生
  • 租号网站是怎么做的wordpress 快讯功能
  • 口碑好的盐城网站建设wordpress课堂主题
  • 网站品牌打造wordpress插件有木马
  • 网站开发与软件研发有什么区别查网站域名备案查询系统
  • 硬盘做免费嗳暧视频网站黄冈免费网站推广平台汇总
  • node做网站怎么知道蜘蛛来过怎么学网站设计
  • 青海省建设厅网站公示公告简单建站
  • 手机网站用什么后台wordpress 百度蜘蛛
  • 网站文章伪原创怎么做手机网站 程序
  • 网站建设每月工作多少开发小程序的目的
  • 社区网站建设方案pptwordpress用户名在哪看
  • 浙江企业响应式网站建设公司简介如何写
  • 自己做静态网站的步骤店面设计在线
  • 活动汪活动策划网站wordpress 无法保存
  • 门户网站开发案例兰州需要做网站的公司有哪些