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

做数据新闻的网站有哪些方面seo优化查询

做数据新闻的网站有哪些方面,seo优化查询,品牌设计主要做哪些内容,做网站教程pdfSpring针对Bean管理中创建对象提供的注解有哪些?Component:普通Service:业务逻辑层Controller:controller层Repository:dao层用注解的方式是为什么?简化xml方式开发,只需要注解就可以完成在配置…

Spring针对Bean管理中创建对象提供的注解有哪些?

@Component:普通

@Service:业务逻辑层

@Controller:controller层

@Repository:dao层

用注解的方式是为什么?

简化xml方式开发,只需要注解就可以完成在配置文件中的配置

如何实现注解开发?

创建对象

组件扫描

package com.atguigu.spring5.ComponentScan;import org.springframework.stereotype.Component;/*** @BelongsProject: 02-Spring* @BelongsPackage: com.atguigu.spring5* @Author: dengLiMei* @CreateTime: 2023-02-04  16:56* @Description: TODO* @Version: 1.0*/
//value可以不写,如果不写默认是类名的首字母小写
@Component(value = "user")
public class User {public void add() {System.out.println("aaaa");}
}
package com.atguigu.spring5.ComponentScan;import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;/*** @BelongsProject: 02-Spring* @BelongsPackage: com.atguigu.spring5.ComponentScan* @Author: dengLiMei* @CreateTime: 2023-02-10  15:12* @Description: TODO* @Version: 1.0*/
public class Main {public static void main(String[] args) {ApplicationContext content= new ClassPathXmlApplicationContext("beans.xml");User user = content.getBean("user", User.class);user.add();}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"><!--    开启组件扫描如果扫描多个包,多个包使用逗号隔开扫描包上层目录--><!--   表示: 扫描包中的所有类--><context:component-scan base-package="com.atguigu.spring5"></context:component-scan><!--    use-default-filters=“false”:表示现在不使用默认filter,自己配置filtercontext:include-filter,设置扫描哪些内容--><!--    表示:  只扫描注解带Controller的类--><context:component-scan base-package="com.atguigu.spring5" use-default-filters="false"><context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/></context:component-scan><!--    下面配置扫描包所有内容context:include-filter,设置扫描哪些内容--><!--    表示:  除了Controller其余类都扫描--><context:component-scan base-package="com.atguigu.spring5"><context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>-filtertype="" expression=""/></context:component-scan>
</beans>

属性注入

@Autowired:根据类型注入

@Qualifier:根据名称进行注入,和Autowired

@Resource:可以根据类型或名称注入

@Value:普通属性注入

javax:java扩展包


完全注解开发

Configuration:作为配置类,替代xml配置文件

package com.atguigu.spring5.SpringConfiguration;import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;@Configuration
@ComponentScan(basePackages = {"com.atguigu.spring5"})
public class SpringConfigure {}
package com.atguigu.spring5.ScopeTest;import org.springframework.stereotype.Component;/*** @BelongsProject: 02-Spring* @BelongsPackage: com.atguigu.spring5.Book* @Author: dengLiMei* @CreateTime: 2023-02-08  19:28* @Description: TODO* @Version: 1.0*/
@Component
public class Book {private String bname;private String bauthor;public void setBname(String bname) {this.bname = bname;}public void setBauthor(String bauthor) {this.bauthor = bauthor;}public static void main(String[] args) {Book book = new Book();book.setBname("abc");}public void testDemo() {System.out.println(bname + "---" + "aaa");}}
package com.atguigu.spring5.SpringConfiguration;import com.atguigu.spring5.ScopeTest.Book;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;/*** @BelongsProject: 02-Spring* @BelongsPackage: com.atguigu.spring5.SpringConfiguration* @Author: dengLiMei* @CreateTime: 2023-02-11  09:38* @Description: TODO* @Version: 1.0*/
public class Main {public static void main(String[] args) {
//        加载配置类ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfigure.class);
//        创建实例Book book = context.getBean("book", Book.class);
//        调用方法book.testDemo();}
}

输出结果:


Spring系列文章:

Spring——是什么?作用?内容?用到的设计模式?

Spring——Bean管理-xml方式进行属性注入

Spring——Bean管理-注解方式进行属性注入

Spring——什么是IOC?

Spring——AOP是什么?如何使用?

Spring——什么是事务?传播行为?事务隔离级别有哪些?

Spring——整合junit4、junit5使用方法

如果有想要交流的内容欢迎在评论区进行留言,如果这篇文档受到了您的喜欢那就留下你点赞+收藏脚印支持一下博主~

http://www.fp688.cn/news/142367.html

相关文章:

  • 济宁做企业网站搜索引擎优化的内部优化
  • 门户网站开发流程视频百度平台客服人工电话
  • 做的网站百度搜索不出来的2023国内外重大新闻事件10条
  • flash源码网站优化大师电脑版官方
  • 国家反诈中心app下载苹果版温州网站建设优化
  • 电脑要登入国外的网站应该怎么做登封网站关键词优化软件
  • 鹿泉区住房建设局网站昆明抖音推广
  • 网站改版建设主要网店运营具体做什么
  • 网购网站建设营业推广策略
  • 杭州电商网站建设免费宣传平台
  • 购买一个网站需要多少钱搜索引擎营销推广
  • 新网站如何做排在前面营销对企业的重要性
  • 开发公司 网站建设价格百度人工申诉客服电话
  • 网站开发需要多长时间广州网络推广定制
  • 慧聪网官网首页如何做谷歌seo推广
  • 静态化动态新闻网站开发权重查询站长工具
  • ps设计素材网站抖音竞价推广怎么做
  • 学前端的十大忠告百度关键词优化工具
  • 如何仿别人网站的莫板seo外链推广平台
  • 网站底部备案代码宁德市自然资源局
  • 建设厅网站174号文简单网页制作成品免费
  • 图书馆网站建设费用全网营销推广方案
  • 网站怎么做右上角消息提醒优化网站技术
  • 张家口做网站的公司四年级摘抄一小段新闻
  • 建筑工程电影网成都seo外包
  • 辽宁建设厅投诉网站十大微商推广平台
  • 做多语言网站不会翻译怎么办网络广告案例以及分析
  • 广州门户网站建设公司seo综合查询接口
  • 外贸网站建设公司如何市场营销八大营销模式
  • 石家庄网站建设人员免费网络推广100种方法