SpringBoot Bean 创建方式 XML + Annotation

SpringBoot入门系列篇(十二):使用XML配置Bean 前情提要 虽然SpringBoot的理念就是零配置编程,但是有时候也会出现绝对需要使用XML进行配置的情况,SpringBoot也同样提供了手动加载XML配置中的bean的方法,下面就来简单的介绍一下 在SpringBoot中简单的使用XML配置Bean 首先新建两个包,org.test1和org.test2,在org.test2包下创建一个Service,代码如下: pa 阅读详情

Spring创建bean方式多种,直接上代码:

  • 通过XML创建Bean有三种方式:默认无参构造,静态工厂,实例工厂
  • 通过Annotation创建Bean有三种方式:注解配置方式,获取配置类中使用Bean注解方式,直接使用注解配置注册Bean,通过扫描指定包路径下通过注解声明的Bean实例。
package com.example.demo;

import com.example.demo.bean.UserService;
import com.example.demo.bean.annotation.BeanAnnotationUserService;
import com.example.demo.bean.annotation.BeanConfig;
import com.example.demo.bean.annotation.ServiceAnnotationUserService;
import com.example.demo.bean.xml.BeanFactoryUserService;
import com.example.demo.bean.xml.BeanInstanceFactoryUserService;
import com.example.demo.bean.xml.BeanXmlUserServcie;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.annotation.Resource;

@SpringBootTest
class DemoApplicationTests {

	@Test
	void testClassPathXmlApplicationContext() {
		ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
		UserService userServcie = (UserService)context.getBean("beanXmlUserServcie");
		System.out.println(userServcie.toString());
	}

	@Test
	void testFactoryClassPathXmlApplicationContext() {
		ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
		UserService userServcie = (UserService)context.getBean("beanFactoryUserService");
		System.out.println(userServcie.toString());
	}

	@Test
	void testInsFactoryClassPathXmlApplicationContext() {
		ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
		UserService userServcie = (UserService)context.getBean("beanInstanceFactoryUserService");
		System.out.println(userServcie.toString());
	}

	@Test
	void testAnnotationConfigApplicationContext() {
		ApplicationContext context = new AnnotationConfigApplicationContext(BeanAnnotationUserService.class);
		UserService userServcie = (UserService)context.getBean("beanAnnotationUserService");
		System.out.println(userServcie.toString());
	}

	@Test
	void testBeanConfigAnnotationConfigApplicationContext() {
		ApplicationContext context = new AnnotationConfigApplicationContext(BeanConfig.class);
		UserService userServcie = (UserService)context.getBean("beanAnnotationUserServiceConfig");
		System.out.println(userServcie.toString());
	}

	@Test
	void testServiceAnnotationConfigApplicationContext() {
		ApplicationContext context = new AnnotationConfigApplicationContext("com.example.demo.bean.annotation");
		UserService userServcie = (UserService)context.getBean("serviceAnnotationUserService");
		System.out.println(userServcie.toString());
	}
}

 

创建一个UserService空接口,方便测试Bean对象获取。

package com.example.demo.bean;

public interface UserService {
}

通过XML获取Bean对象BeanXmlUserServcie 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="beanXmlUserServcie" class="com.example.demo.bean.xml.BeanXmlUserServcie"></bean>
</beans>
package com.example.demo.bean.xml;

import com.example.demo.bean.UserService;

/**
 * @author wangSong
 */
public class BeanXmlUserServcie implements UserService {
    @Override
    public String toString() {
        return "this bean is create by Spring bean Xml";
    }
}

通过静态工厂获取Bean实例对象 BeanFactoryUserService

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="beanFactoryUserService" class="com.example.demo.bean.xml.StaticFactory" factory-method="createUserService"></bean>
</beans>
package com.example.demo.bean.xml;

import com.example.demo.bean.UserService;

public class StaticFactory {

    public static UserService  createUserService(){
        return new BeanFactoryUserService();
    }
}

package com.example.demo.bean.xml;

import com.example.demo.bean.UserService;

public class BeanFactoryUserService implements UserService {
    @Override
    public String toString() {
        return "this bean is create by Spring Bean Static Factory Xml";
    }
}

通过实例工厂获取Bean对象BeanInstanceFactoryUserService

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="instanceFactory" class="com.example.demo.bean.xml.InstanceFactory"></bean>
    <bean id="beanInstanceFactoryUserService" factory-bean="instanceFactory" factory-method="createUserService"></bean>

</beans>
package com.example.demo.bean.xml;

import com.example.demo.bean.UserService;

public class InstanceFactory {

    public  UserService  createUserService(){
        return new BeanInstanceFactoryUserService();
    }
}

package com.example.demo.bean.xml;

import com.example.demo.bean.UserService;

public class BeanInstanceFactoryUserService implements UserService {
    @Override
    public String toString() {
        return "this bean is create by Spring Bean Instance Factory Xml";
    }
}

通过注解配置获取配置的Bean实例,也可以直接获取指定class对象Bean实例。

package com.example.demo.bean.annotation;

import com.example.demo.bean.UserService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BeanConfig {

    @Bean(name="beanAnnotationUserServiceConfig")
   public UserService getBeanUserService(){
       return new BeanAnnotationUserService();
   }
}

通过扫描包下注解类,获取Bean实例

package com.example.demo.bean.annotation;

import com.example.demo.bean.UserService;
import org.springframework.stereotype.Service;

@Service(value="serviceAnnotationUserService")
public class ServiceAnnotationUserService implements UserService {
    @Override
    public String toString() {
        return "this bean is create by Spring Service Annotation ";
    }
}

 

Spring Boot 3.x 系列【16】创建Bean的八种方式 在Spring中,Bean是指由容器实例化、组装和管理的对象,是构成应用程序的组件。为了更好的使用,所以接下来汇总学习下Spring提供创建Bean的多种方式以及使用场景。 阅读详情

相关推荐

基于分位数回归的静态CoVaR计算 案例与代码

原文链接:https://bbs.pinggu.org/thread-7925441-1-1.html 一、静态CoVaR模型介绍 二、资料简介 实现对相关期刊论文进行论文重现,解决实证分析中的技术操作问题。里面包含了每一步详细的步骤,可以方便的利用这个手册解决大部分利用分位数回归计算静态CoVaR的论文的模型实现问题。即从数据下载到模型实现一整条操作步骤。 关键词:【分位数回归】【Co...

ChenQihome9的博客 7503

spring创建bean的三种方式

spring创建bean的三种方式

西北狼的博客 3017

【Linux】常见指令的使用

Linux常用指令

qq_74897518的博客 1479

SpringBoot-Bean创建流程

版本:2.1.7.RELEASE有一点需要先明确:Spring 只帮我们管理单例模式 Bean 的完整生命周期,对于 prototype 的 bean ,Spring在创建好交给使用者之后则不会再管理后续的生命周期。

m0_67401761的博客 747

TMC2209的UART模式详解:如何用串口调试助手配置细分和电流(避坑指南)

本文深入解析TMC2209步进电机驱动器的UART模式,详细讲解如何通过串口调试助手配置细分和电流,包括硬件连接、通信协议、关键寄存器设置及高级功能应用。提供实战避坑指南,帮助开发者优化步进电机控制性能,适用于精密仪器、3D打印等场景。

weixin_29166013的博客 541

小红书UID泄露风险揭秘:如何防止你的手机号被社工库关联(附防护指南)

本文揭示了小红书UID泄露的严重风险,详细解析了UID与手机号关联后被社工库利用的完整链条。通过分析黑产的数据整合技术,提供从基础到进阶的防护策略,包括密码管理、账号隔离和应急响应措施,帮助用户有效防范个人信息泄露风险。

ol789012345的博客 1504

Springboot利用xml配置文件方的式注入bean

引子: 在生成验证码图片的时候需要用到com.octo.captcha.service.image.DefaultManageableImageCaptchaService,但是springboot没有提供给applicationcontext.xml文件,无法利用xml配置文件方式注入。 如图所示直接采用注解的方式,启动会报错 解决方法 利用xml配置文件的方式注入bean 步骤如下 1、创建...

graves-yu的博客 4498

PCL 均匀采样【2026最新版】

根据输入点云数据创建一个微小的三维立方体集合,然后计算每个三维立方体的重心;由于该重心点不一定是原始点云中的点,直接用该点来表示立方体内所有的点会丢失原始点云的细小特征;所以使用k最近邻搜索寻找距离重心点最近的原始点来代替重心点。

点云侠的博客 41万+

1. SpringBoot快速回顾(分别使用注解和xml方式去声明Bean,获取Bean)

对于创建的实体类,springboot如何声明为Bean,如果获取bean,本文使用详细案例演示说明。用于回顾相关知识点

Wyatt_zhai 2347

从Safety Manual到系统安全概念

本文系统阐述了构建功能安全"证据链"的工程化方法论,核心要点包括:1)建立"风险→对策→验证→证据"闭环链条;2)SafetyManual和FMEDA作为关键证据支撑点,前者界定系统安全边界,后者量化诊断覆盖率;3)通过四步法继承芯片安全机制并扩展至系统级;4)形成"设计-分析-验证"三维闭环体系,包括安全目标、技术实现和验证矩阵;5)强调证据链闭环对安全认证和OEM认可的重要性。该方法论实现了从理论要求到工程实践的完整转化,确保安全设计可验证、可

VehSwHwDeveloper的博客 720

【智能车Code review】—曲率计算、最小二乘法拟合

【1】曲率计算函数 选三个点计算曲率 float process_curvity(byte x1, byte y1, byte x2, byte y2, byte x3, byte y3) { float K; int S_of_ABC = ((x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)) / 2; //面积的符号表示方向 byte q1 = (byte)((x2 - x1) * (x2 - x1) + (y2 - y1) *

hanhan的博客 1万+

Spring框架总结(2)

XML配置续&amp;annotation注解 SpringBoot:分布式微框架,把一个大项目分解成若干小项目,远程相互调用 命名空间:namespaces(在applicationContext.xml页面左下角  ,勾选响应的命名空间即可使用) Util Schema:这个命名空间包含了一些定义集合对象的标记 util:list 标签(一个 list 供多个对象复用) util:...

Code change the World. 206

ARM功耗管理软件之DVFS&AVS

思考:功耗管理软件栈及示例?WFI&WFE?时钟&电源树?DVFS&AVS?

AI-安全-功耗 1230

SpringBoot~ IDEA 创建 SpringBoot项目 并且基于Annotation装配Bean(1)

4.0.0frank名字随意springbootruntimetruelomboktruetest/**Time: 9:56*/Spring Boot的配置介绍。

2401_89285764的博客 739

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

SpringBoot~ IDEA 创建 SpringBoot项目 并且基于Annotation装配Bean

runtimetruelomboktruetest/**Time: 9:56*/Spring Boot的配置介绍。

2401_89285764的博客 630

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

springboot加载外部xml_SpringBoot 加载外部Bean的几种方式

Spring从3.0之后,就逐步倾向于使用java code config方式来进行bean的配置,在spring-boot中,这种风格就更为明显了。在查看spring-boot工程的时候,总想着探究一下spring-boot如何简单的声明一个starter、Enable××,就能额外增加一个强大的功能,spring是如何找到这些具体的实现bean的呢。目前,我总结大概有这么几种:直接在工程中使用...

weixin_30343429的博客 1053

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

SpringBoot 组件注册 -- 注解方式 & xml配置方式

一. 在java开发中要将一个java bean注入到spring上下文中总体有两种方式: 1. 通过xml配置方式,最初始的方式,就是在xml配置文件中通过<bean><bean/>标签的方式,在加载spring上下文时加载spring的配置文件即可将配置文件中的所有bean加载到spring上下文中:如下: <?xml version="1.0" encod...

A tortoise running wild 648

springboot开发,注解Annotation和xml配置同时兼容,比如项目中原来的bean xml配置如何通过注解进行使用

springboot开发,常用注解的方式,进行自动装配。 但是有时为了同时兼容项目中原来的bean xml配置,那么应该如何把xml文件 加载到 ioc容器中呢,比如 在resources 目录下,有个 springContext.xml 的xml配置文件,我们只需要 加一个注解搞定: @ImportResource(locations = "springContext.xml") 代码如下: @Configuration @ImportResource(locations = "sp...

xzb5566的专栏 495

springboot引入外部xml配置文件

1、 resources下创建xml <?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:...

weixin_36498094的博客 3480

Java方式bean的注入以及自动配置

Java配置 Java配置的本质上,就是使用一个Java类去代替xml配置,这种配置方式在目前最主流的Spring Boot中得到了广泛的使用。 1、引入相关Spring相关依赖 2、创建Java配置类: /** * 这是一个Java配置类,它的作用类似于applicationContext.xml配置文件 * @author 叶小陌 * */ @Configuration public...

知性人 -- 的博客 1655

Spring中的Bean

文章目录一、bean的配置如何使用:1、创建实体类2、创建bean3、测试二、Bean的作用域测试常用的作用域三、基于Annotation的装配使用四、自动装配如何使用 一、bean的配置 Spring中,xml配置文件的根元素是< beans>,< beans>中可以包含多个< bean>子元素,每一个 < bean>子元素定义了一个Bean,并描述了该Bean如何被装配到Spring容器中。 < bean>子元素中包含多个属性和子元素如下:

二十四桥明月夜的博客 1204

Springboot中Xstream和JAXB方式处理xml与bean相互转换对比

JAXB vs XStream 这两东东本质上是有差别的,JAXB称为OX binding工具,XStream应该算序列化工具,但OX binding工具也会marshall和unmarshall,所以包含了序列化这一部分。序列化工具不一定需要提供binding的功能。既然都玩序列化,那就简单地比较一下它们两在序列化方面的强弱吧。 JAXB:Toplink JAXB 10133,应该是JAXB 1.1标准 (取消了schema的validation功能) XStream:1.3.1 数据长度:

HD243608836的博客 767

学习springboot必备---spring注解驱动开发1-bean的创建

这篇文章主要介绍spring的基础注解的使用,为springboot的学习打下基础 如果小伙伴们看springboot中大量的底层基础注解感觉懵懵的话,那么看这篇文章就对了,这篇文章是复习spring的一些注解,可以对学习springboot有帮助。 spring Bean的创建方式 在之前我们注册一个bean可能是这样的: 在spring的配置文件中写一下内容: <bean id="school" class="com.xxx.school"> <property name="name

jsty181818的博客 531

搭建springboot运行报错:java.lang.annotation.AnnotationFormatError

最近刚搭建了一个springboot的demo,启动报错: java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation.MapperScan.factoryBean() 具体如图: 原因是缺少一个spring.m...

a1106103430的博客 5423

《SpringBoot 3:入门与应用实战》第 3 章 IOC 容器中的 Bean 阅读笔记 4

《SpringBoot 3:入门与应用实战》第 3 章 IOC 容器中的 Bean 阅读笔记 4

道友 294

Spring-IOC实现【03-其他实现方式】

接上文Spring-IOC实现【01-XML配置方式】 Java配置方式 SpringBoot流行之后,Java 配置开始被广泛使用。 Java配置本质上,就是使用一个Java类去代替xml配置,这种配置方式在SpringBoot中得到了广泛的使用。 实现步骤如下: 创建java项目 引入相关jar包 创建实体类 创建配置文件类 /** * 该类相当于 application.xml文件 ...

波波烤鸭的博客 3115
上一篇: idea2018配置Maven3.6.2/Maven3.6.3【Error】com.google.inject.CreationException: Unable to create injector
下一篇: SpringBoot2.0学习笔记:Spring Boot中集成Redis
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

仰望星空@脚踏实地

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值