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

贵港购物网站开发设计怎样在百度上发布免费广告

贵港购物网站开发设计,怎样在百度上发布免费广告,天津市精神文明建设委员会网站,国际知名设计公司收入在前面的学习中,通过读取xml文件将类加载,或他通过xml扫描包,将包中的类加载。无论如何都需要通过读取xml才能够进行后续操作。 在此创建配置类。通过对配置类的读取替代xml的功能。 配置类就是Java类,有以下内容需要执行&#…

在前面的学习中,通过读取xml文件将类加载,或他通过xml扫描包,将包中的类加载。无论如何都需要通过读取xml才能够进行后续操作。

在此创建配置类。通过对配置类的读取替代xml的功能。

配置类就是Java类,有以下内容需要执行:

1:对类使用注解@Configuration标注。

2:使用注解@ComponentScan扫描包,将包中的类加载。

 配置类SpringConfig:

package com.annotation.config;import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;/*** @copyright 2003-2025* @author    qiao wei* @date      2025-04-18* @version   1.0* @brief     * @history   name*            date*            brief*/
@Configuration// <context:component-scan base-package="com.annotation.thirdjar" />
@ComponentScan(basePackages = {"com.annotation.thirdjar", "com.itheima.dao.impl"})
public class SpringConfig {
}

在这里配置类加载了两个包,两个包里的类都可以被调用。

加载配置类:

package com.annotation.config;import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;import static org.junit.jupiter.api.Assertions.*;/*** @copyright 2003-2025* @author    qiao wei* @date      2025-04-18* @version   1.0* @brief     * @history   name*            date*            brief*/
class SpringConfigTest {@Testpublic void test01() {ApplicationContext context =new AnnotationConfigApplicationContext(SpringConfig.class);String date = (String) context.getBean("getDateInStringFormat");System.out.println(date);}
}

运行结果显示当前年月日及时间。

调用的类如下:

package com.annotation.thirdjar;import java.util.Date;import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;/*** @copyright 2003-2025* @author    qiao wei* @date      2025-04-16* @version   1.0* @brief     * @history   name*            date*            brief*/
@Component(value = "factory")
public class DateFactory {public DateFactory() {}@Bean(name = "getDate001")public Date getDate() {return new Date();}
}

package com.annotation.thirdjar;import java.text.SimpleDateFormat;
import java.util.Date;import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;/*** @copyright 2003-2025* @author    qiao wei* @date      2025-04-15* @version   1.0* @brief     * @history   name*            date*            brief*/
@Component
public class DateFormat02 {public DateFormat02() {}/*** @author  qiao wei* @brief   带参数。基本类型使用@Value,引用类型使用@Qualifier。* @param   * @return  * @throws  * @history name*          date*          brief*/@Bean(value = "simpleDateFormat")public SimpleDateFormat getSimpleDateFormat(@Value ("yyyy-MM-dd HH:mm:ss z") String format) {return new SimpleDateFormat(format);}/*** @author  qiao wei* @brief   方法带参数的注解Bean。* @param   * @return  * @throws  * @history name*          date*          brief*/@Bean(value = "dateFormatInString")public String getDateFormat(@Value(DATE_FORMAT) String format,@Qualifier(value = "factory") DateFactory dateFactory) {return new SimpleDateFormat(format).format(dateFactory.getDate());}/*** @author  qiao wei* @brief   方法带参数的注解Bean。注意与test02相比,参数date调用的是类Factory的getDate方法的返回值。* @param   * @return  * @throws  * @history name*          date*          brief*/@Bean(value = "getDateInStringFormat")public String getDateFormat(@Value(DATE_FORMAT) String format,@Qualifier(value = "getDate001") Date date) {return new SimpleDateFormat(format).format(date);}private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
}

http://www.dtcms.com/wzjs/51742.html

相关文章:

  • 石家庄企业商城网站建设刷关键词怎么刷
  • 网站建设费要摊销视频外链在线生成
  • 章丘做网站单位哪家好西安seo网站排名
  • 专门做asmr的网站北京seo优化分析
  • WordPress可以做政府网站吗公司网络营销推广
  • 网站建设全新闻摘抄四年级下册
  • 新城镇建设官方网站微信管理系统平台
  • wordpress首页分页函数十堰seo排名公司
  • 天猫商城的商品来源seo搜索引擎优化期末及答案
  • 山东环保行业网站开发整站seo怎么做
  • csgo翻硬币网站开发网络营销策略概念
  • 设计网站流程seo线上培训班
  • 许昌住房建设局的网站全网
  • 郫县做网站新闻早知道
  • wordpress防止css采集seo教程自学
  • 做网站 推广买外链网站
  • 做网站至少要花多少钱百度网盘客服人工电话95188
  • 自己免费做网站郑州网络公司
  • 专注做一家男生最爱的网站网站怎么做收录
  • wordpress防攻击搜索引擎优化的概念
  • 济南 营销型网站建设营销顾问公司
  • 北京天仪建设工程质量检测所网站优秀软文范例
  • 网络技术培训机构网站怎么优化排名靠前
  • 学校营销型网站昆明seo外包
  • 网站建设上市阿森纳英超积分
  • 做wap网站数据分析师培训
  • 天河区pc端网站建设网店推广的作用是什么
  • 做网站应该掌握的技术网站优化推广seo公司
  • ps做网站logo微商软文推广平台
  • 北京建设网站的百度关键词排名代做