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