Spring. DM web development environment setup
By herobeast, 367 read,0Comment,
Favorites,
Edit
Summary
As a beginner, building a web development environment for spring. DM is still a little troublesome. I encountered n problems and made many detours. This article introduces two simple spring. DM osgi web development environments.
Method 1
And previousArticleSimilar, please move here: Spring. DM helloworld
First reference the DIST and Lib folder in the spring-osgi-2.0.0.M1 folder package (not clear, please see spring. DM version helloworld environment preparation chapter), the specific effect of the referenced package is as follows:
Figure 1
Configure "Running options", eclipse menu: Run-> RUN deployments ..., The configuration running window appears. Right-click "osgi framework" in the left-side pane and click "new", as shown in.
Figure 2
Then click the "run" button to see the following results:
Figure 3
We can see that tomcat has been successfully started and the development environment is ready.
But now there is a problem: some missing dependency packages will appear in the "Validate bundles" button in Figure 2, as shown in. In this step, Tomcat can also be used up, we will use the 2nd Methods
To solve this problem.
Figure 4
2nd Methods
Idea: you do not need to use the default target platform. You can define a folder, put the relevant jar package into this file, create a new target platform, and set it to the default one, this target platform will be used for running at runtime. Next let's start.
First, create a folder "target_spring_web" (you can name it at will) and put the required jar package in. The final result is shown in:
Figure 5
In the eclipse menu, choose windows> preference. In the following window, select target platform on the left panel, as shown in, and click Add. 7.
Figure 6
Figure 7
Select "nothing: start with an empty target definition" in, and click "Next" to start the target definition interface, as shown in,
Figure 8
Click "add" in, as shown in the page for adding content. Select "directory" and click "Next"
Figure 9
Figure 10
In, click "Browse" to browse the target_spring_web we just created. The jar package in this directory is displayed, as shown in. Click "finish" to complete the addition;
Figure 11
Figure 12
In 12, we can see 19 jar packages in the target_spring_web directory, and then select the "content" tab, as shown in, 19 plug-ins are selected, click "finish", create target.
Figure 13
Figure 14
In, you can see the target platform we created, select it, click "Apply", and then click "OK" to complete the creation.
Now, let's create the running configuration item, eclipse menu: Run-> RUN configurations ..., The "Run configuration" page appears. Right-click the osgi framework and select "new" to create one. I changed the name to spring_web. You can modify it according to your habits and select 19 bundles, click Verify. A message is displayed, indicating that no dependency is detected, as shown in. Click "Apply" and "run". The time to witness the miracle is now!
The running result is as follows:
Notes
In spring. DM helloworld encountered a log exception problem and found many solutions on the Internet, some of which were to create a fragment project to eliminate the log exception problem,
You can see in Figure 5 with the red box bundle, version changed to: com.springsource.org. Apache. commons. logging-1.1.1.jar, just fine.
Experience
Another way to configure the environment is to use osgi to support spring ide. The general principle is the same as that in method 2nd, that is, the osgi version is different from ours. The first method is relatively simple, but many bundle references will appear in the project, which is annoying and not recommended. The second solution is recommended.