First Spring instance

xiaoxiao2021-03-06  70

1. In JBuilder, Add Libraries joins all JARs in the lib DIST in Spring.

2. Press to write the instance, write a test, and write a test to test (will not use jnuit to fail), but find, ApplicationContext CTX = New FileSystemXmlapplicationContext ("bean.xml" ApplicationContext, FileSystemXmlapplicationContext, cannot be identified. With Google, find the class org.springframework.context. * And org.springframework.context.support. *. Note, you must be familiar with each class in the future.

3. Bean.xml must be in the main directory of the project, that is, with JPX, otherwise it will not be found.

4. Just a simple copy of the BEAN.XML in the "Spring Development Guide, the compilation error, said that Beans cannot be identified. Later, add , compiled. It seems that this declaration is particularly specified DTD, but it is still very important. In the DTD, it should define keywords such as Beans, and cannot be lazy.

I finally took the first step, although the principle was not very clear, but still happy afternoon.

At the end of the final compilation process, you can see something.

- Loading XML Bean Definitions from file [d: /jbproject/springtest/bean.xml]

- Bean factory for application context [org.springframework.context.support.FileSystemXmlApplicationContext; hashCode = 26281671]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [TheAction]; Root of BeanFactory hierarchy

- 1 Beans Defined in ApplicationContext [Org.SpringFramework.Context.support.FilesystemXmlapplicationContext; Hashcode = 26281671]

- No Messagesource Found for Context [Org.SpringFramework.Context.support.FilesystemXmlapplicationContext; Hashcode = 26281671]: Using Empty Default

- No ApplicationEventMulticaster Found for Context [Org.SpringFramework.Context.support.FilesystemXmlapplicationContext; Hashcode = 26281671]: Using Default

- Refreshing Listener

- Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [TheAction]; Root of BeanFactory hierarchy] - Creating shared instance of singleton bean 'TheAction'

Hello Rod Johnson

转载请注明原文地址:https://www.9cbs.com/read-120191.html

New Post(0)