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

建网站html5找人做网站协议

建网站html5,找人做网站协议,wordpress游客发言,网站建站代码conditionalSpring中的Profile批注可用于任何自动检测候选对象的Spring组件#xff08;例如#xff0c; Service Component#xff0c; Service Component #xff0c; Service Configuration等#xff09;。 Profile批注接受单个配置文件或一组必须是活动的配置文件… conditional Spring中的Profile批注可用于任何自动检测候选对象的Spring组件例如 Service Component Service Component Service Configuration等。 Profile批注接受单个配置文件或一组必须是活动的配置文件以使带注释的组件有资格进行自动检测。 对于给定的Profile({p1, !p2}) 如果配置文件p1处于活动状态或配置文件p2不处于活动状态则会进行注册。 或至关重要。 但是如何使用Profile实现此目标如果配置文件p1处于活动状态并且配置文件p2 和 p3均处于非活动状态我们想激活给定的组件吗 让我们假设以下情况我们有一个NotificationSender接口该接口由以下方式实现 SendGridNotificationSender –仅在sendgrid配置文件处于活动状态时才处于活动状态 EmailNotificationSender –仅在email配置文件处于活动状态时才活动。 NoOpNotificationSender –仅在development配置文件处于活动状态且sendgrid和email没有处于活动状态时才处于活动状态。 另外一次只能注册一个NotificationSender development配置文件可以与sendgrid和email配置文件结合使用。 在上述情况下使用Profile注释似乎还不够。 也许我使事情变得有些复杂但实际上我真的很想实现上述目标而没有介绍其他配置文件。 我是怎么做到的 我使用了Spring的4 Conditional注释。 当所有指定Condition匹配时 Conditional允许注册组件 Component Conditional(value NoOpNotificationSender.ProfilesCondition.class) class NoOpNotificationSender extends NotificationSenderAdapter {} ProfilesCondition实现org.springframework.context.annotation.Condition接口 public static class ProfilesCondition implements Condition {Overridepublic boolean matches(ConditionContext c, AnnotatedTypeMetadata m) {} } 问题的整体解决方案 Component Conditional(value NoOpNotificationSender.ProfilesCondition.class) class NoOpNotificationSender extends NotificationSenderAdapter {static class ProfilesCondition implements Condition {Overridepublic boolean matches(ConditionContext c, AnnotatedTypeMetadata m) {return accepts(c, Profiles.DEVELOPMENT) !accepts(c, Profiles.MAIL) !accepts(c, Profiles.SEND_GRID);}private boolean accepts(ConditionContext c, String profile) {return c.getEnvironment().acceptsProfiles(profile);}} } 当适当的配置文件处于活动状态时其他组件将被激活 Component Profile(value Profiles.SEND_GRID) public class SendGridNotificationSender extends NotificationSenderAdapter {}Component Profile(value Profiles.MAIL) class EmailNotificationSender extends NotificationSenderAdapter {} 用法示例 活动资​​料 豆 发展 NoOpNotificationSender 开发sendgrid SendGridNotificationSender 开发邮件 EmailNotificationSender sendgrid SendGridNotificationSender 邮件 EmailNotificationSender 你怎么看 您将如何解决这个问题 翻译自: https://www.javacodegeeks.com/2015/11/register-components-using-conditional-condition-spring.htmlconditional
http://www.sadfv.cn/news/40279/

相关文章:

  • 长春个人网站制作学ui设计好就业吗
  • 网站权重6了该则么做优化方案保定网页模板建站
  • 五合一网站做优化好用吗网站设计流程的步骤
  • 百度网站加v搜索网站入口
  • 企业网站做优化卖家电商平台有哪些
  • 付费网站推广开发的某网站建设公司网站源码
  • 佛山模板网站建站wordpress字体样式
  • php网站建设用什么网站美工和平面设计
  • 苏州住房与城乡建设部网站移动端什么意思
  • linux下网站开发深圳教育平台网站建设
  • 网站建设公司北京网站推广策划思路与执行
  • 建一个网站需要什么条件网站建设电话销售不被挂断
  • wordpress 漏洞哈尔滨排名seo公司
  • 哪些网站可以接单做互联网挣钱的路子
  • 淮安做网站优化建设第三方公众号平台网站教程
  • microsoft做网站seo实战密码第四版
  • 我的三次做网站的经历炫酷的移动端网站
  • 网站二维码怎么制作哪些网站做的海报比较高大上
  • 阳区城市规划建设局网站山西省煤炭基本建设局网站
  • 无法打开网站若要访问本地iis网站必须安装下列iis组件自己做的网站显示不安全怎么回事
  • 郑州网站制作专业乐云seo廊坊cms建站系统
  • 北京好的网站设计机构凡科商城是什么
  • ps手机网站页面设计不会网站维护可以做吗
  • 汕头cms模板建站深圳的大公司
  • 成都网站搭建公司哪家便宜的建站网站
  • icp ip 网站备案南宁网站设计
  • 如何选择家居网站建设企业品牌推广的核心目的是
  • 网站响应式与电脑版有什么区别河南专业做网站
  • 大型电子商务网站建设成本建设部网站施工合同
  • 网站开发工作量评估做网站推广员工