Idea Project Structure the role of Spring under modules plate Engineering

Source: Internet
Author: User

is to study the role of this thing.

I accidentally found that the bean between the different XML files in the case of no use of import can actually link the past, just want to understand why.

Package structure

I wrote two Pojo:Boss.java Car. java

A test class Demo.java

Perform the main function to run normally:

However, take a look at two separate configuration files:

The quoted car is red and cannot be linked to the car.xml bean.

Next is the topic of the thing to say ~

, add an app context, hook up two XML files, and click OK. This completes the operation of putting Boss.xml and car.xml in the same context as idea can recognize.

And see if Boss.xml is still floating red ~

Can see, no, and can link to go.

We cannot help but ask: does this thing have the same function as import?

A try will know ~

Modify the main function of the demo

Notice that we have removed the car.xml in path, if the function of adding the application context in idea is equivalent to import, then it should be able to print normally, the result

It's blown.

So, this is actually an idea that makes it easier for readers to see a function of the bean, and we have a half-penny relationship with the code we execute .

It's good to use beans across XML or import or add parameters in ApplicationContext.

Idea Project Structure the role of Spring under modules plate Engineering

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.