Spring Frame Notes (iv)--spring container property configuration six topics

Source: Internet
Author: User

Topic One: The value of the Bean node in the configuration of the literal question, we present a concept-literal value. Literal: The value represented by the available string. Literals can be

The element tag or the Value property is injected. The basic data types and their encapsulation classes, String types, and so on, can be injected in literal form if the literal value contains special characters, you can use   to enclose the literal value. For example: (This article is from: http://my.oschina.net/happyBKs/blog/478074) 12345678910111213141516200000        ] >car definition: 123456789101112131415161718192021222324252627282930package com.happBKs.spring.iocaop.beans; public class Car {   string name,    double price;    public String GetName () {  &nbs P    return name;    }    public void SetName (String name) {       this.name = name;    }    public Double GetPrice () {       return price;    }    public void Setprice (double price) {       this.price = Price;    }    public Car () {       super ();    }    public Car (String name1, double price1) {       super ();     &N Bsp  this.name = name1; &nbSp      this.price = Price1;    }     @Override    public String toString () {       return "Car [name] = "+ name +", price= "+ Price +"] ";    }} Test code: 12345678910@test    public void Test8 ()    {       //Create Sprin G IOC container object. Classpathxmlapplicationcontext represents a configuration file under the Classpath, which is an implementation class for interface ApplicationContext.        applicationcontext ctx=new classpathxmlapplicationcontext ("Applicationcontext.xml");        //get the bean instance from the IOC container        car cbean= (Car) Ctx.getbean ("car_value_id");        //Call object method        SYSTEM.OUT.PRINTLN (Cbean);    } result output: Car [Name=, price=200000.0] in the previous example, the property value can be configured using the Value child node.

This article from "Just a Dream" blog, declined reprint!

Spring Frame Notes (iv)--spring container property configuration six topics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.