In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Build an environment
1. IDE uses the J2EE version of Eclipse. To ensure that Maven is installed, you can use Eclipse's Install New Software to install it.
Then click Next, install it and restart it again.
Note: when using the latest version of Eclipse, you can skip this step because the latest version of Eclipse already has built-in Maven.
2. After installing Maven, do not use the Maven that comes with IDE. Download one officially, and then let the Maven of IDE point to the Maven path of your download and installation, as shown in the figure:
Create a Maven project
1. Create a new Maven Project,File- > New- > Other- > Maven Project, select default, then click Next, and select maven-archetype-webapp in Select an Archetype, as shown below:
2. Click Next, type groupId:xxx;artifactId:xxx, then click Finish, wait a while, and then create it. The following figure shows an initial project that has been created:
IV. Customize the Maven project structure
Now the created project structure is not a standard Maven project structure, so you need to adjust the project structure.
1. Add Source Folder
Add three Source Folder of src/main/java,src/test/java and src/test/resources, right-click the project root directory and click New-> Source Folder to create the three Source Folder. Note that instead of building an ordinary Folder, it is Source Folder, as shown in the figure:
Note: you can also add src/test/java and src/test/resources for Junit testing here.
2. Create a package
Create 3 packages in src/main/java (the maven standard recommends a 3-tier package structure).
3. Modify JRE
Modify the JRE System Libary according to JDK.
4. Create a Web-related folder
You can think of src/main/webapp as WebRoot, and create folders such as js,css,jsp in this directory.
At this point, the directory structure of the project is shown in the figure:
Configure the project BuldPath1 and change the classes path
Right-click the project-> Properties- > Java Build Path-> Source, and there should be these four folders below: src/main/java,src/main/resources,src/test/java, src/test/resources. Double-click the Output folder for each folder and select the path:
① src/main/java,src/main/resources, select target/classes
② src/test/java, src/test/resources, select target/test-classes
Choose Allow output folders for source folders.
2. Change the display order of folders
Click Order and Export to change the order in which folders are displayed.
3. Change the JDK version
Double-click JRE System Library in Libraries, and version 1.6 or 1.7 is recommended.
Turn the project into a Dynamic Web project
Note: if you create a Maven Project with the latest version of Eclipse, the project is already a Dynamic Web project by default, and only the Dynamic Web version needs to be adjusted here.
1. Conversion project
Right-click Project-> Properties- > Project Facets, and click Convert to faceted from, as shown in the figure:
2. Configure Project Facets
Change the Version of Dynamic Web Module to 2.5. (3.0for Java7). If the prompt is wrong, you may need to set the Compiler compliance level to 1. 6 in Java Compiler. Or you need to change the Version of the Java in this window to 1.6.
3. Configure Modify Faceted Project
Click Further configuration available... , pop-up Modify Faceted Project window, here is to set the path of the web.xml file, enter src/main/webapp,Generate web.xml deployment descriptor to generate the web.xml file automatically, optional or not.
Setting up deployment assemblies (Web Deployment Assembly)
Right-click Project-> Properties- > Deployment Assembly, as shown in the figure:
The list here is the path to the file release when the project is deployed, and you need to do the following:
① We removed two items from test because test is for test use and does not need to be deployed.
② sets the jar package of Maven to be published under lib, Add-> Java Build Path Entries-> Maven Dependencies-> Finish
The completion effect of the configuration is as shown in the figure:
8. Configuration file 1. Configure pom.xml
Add the necessary jar package dependence to the pom file, which can be queried from two places:
After modifying the pom file, save, maven will automatically go to download these jar packages to the local.
2. Configure web.xml
Configure Spring,spring MVC,log4j, garbled handling, etc.
3. Configure properties
Add configuration files such as log4j.properties,jdbc.properties
4. Configure ApplicationContext.xml
The ApplicationContext.xml file is the configuration file for Spring
5. Configure xxx-servlet.xml
The xxx-servlet.xml file is the configuration file for SpringMVC, and the name of the xxx is configured in the web.xml file.
6. Configure ImplAndBusinessBeans.xml
ImplAndBusinessBeans.xml files mainly place bean objects for implementation and Business.
7. Configure SqlMapConfig.xml
The SqlMapConfig.xml file is the configuration file for Mybatis
8. Configure Test.xml
The Test.xml file is the Mapper configuration file for Mybatis
9. Create a package
Bean: put pojo, java bean
Business: put the business layer
Conroller: put the control layer, which is mainly responsible for accepting requests and calling business, and returns the view result.
Dao: put the interface corresponding to each bean
Impl: the concrete implementation of dal interface
Interceptor: filter
Resource: resource bundle, such as file path, configuration file
Test: test package
Util: toolkit
The full package name configuration path is shown in the figure:
Write the project code
Considering the length, all the code is omitted here. For more information, please see the Google Code link provided in the first part of the article.
11. The overall structure of the project
1. Use Alibaba Druid connection pool (efficient, powerful and scalable database connection pool, monitor database access performance, support Common-Logging, Log4j and JdkLog, monitor database access)
two。 Provide high concurrency JMS message processing mechanism
3. All functional modularization, all module service, all service atomization, provide an extensible service model, so that the program runs stably and never downtime.
4. Provides Wink Rest and Webservice services, so it can be deployed as an independent service platform
Framework integration:
Springmvc + Mybatis + Shiro (permission) + REST (Service) + WebService (Service) + JMS (message) + Lucene (search engine) + Quartz (scheduled scheduling) + Bootstrap Html5 (support for PC, IOS, Android)
Introduction to the framework:
Project Maven construction, real large-scale Internet architecture, to achieve high concurrency, big data processing, the whole project uses customized service ideas, to provide modular, service-oriented, atomized solution, the functional modules will be split, can be shared to all projects. The architecture adopts distributed deployment architecture, and all modules are split, so that the project is absolutely decoupled and stability trumps everything.
Continuous integration:
1. My to-do workflow service (providing Webservice services)
two。 My to-do workflow integrates JMS message services (supports high concurrency and can support thousands of system integration)
3. My tasks provide Rest services, complete daily work management, and dynamically generate my tasks, cycle tasks, scheduled mail reminders to complete tasks, etc., through the scheduled scheduling platform.
4. File upload, multithreaded download service, sending mail, short message service, department information service, product information service, information release service, my subscription service, my task service, public link, my collection service, etc.
System module:
1. User Management:
User information management (add, delete, modify, user authorization, user column management, query, etc.)
User group management (add, delete, modify, user group column authorization, column authorization, query, user group personnel add query, etc.)
User role management (add, delete, modify, user role authorization, user role column information query settings, etc.)
two。 Article Management:
Column management: query infinite pole column tree, create infinite pole column tree classification (navigation column, picture list column, article list column, article content column, etc.), delete, modify column information.
Article management: create, delete, modify articles, multi-dimensional article queries, including published, unpublished, all articles, etc. Article rich text editor, article multi-file upload, article status control and so on.
3. System Settings:
Data dictionary management: support Chinese and English information, support unlimited level classification configuration, dynamic control whether available, etc.
Department information management: support unlimited level department information in Chinese and English to add, delete, modify operation, department list, tree heart query and so on.
Log management: system log list query, online viewing, online download, etc.
Route management: integrate Baidu map API, provide line query management function
Druid Monitor (monitoring): integrate Alibaba connection pool, provide online connection pool monitoring program, including: data source, SQL monitoring, URL monitoring, Session monitoring, Spring monitoring, etc.
Website information management: operate the website content through the system configuration file, including mail server configuration, company basic information configuration and so on.
4. Integrated REST service, which can be used as an independent service platform (provides a large number of examples and testing platforms, including: file uploads and downloads, email messages, departments, products, public connections, my favorites, my tasks, information release, etc.)
5. Integrated Quartz scheduling, which can be used as a timing scheduling platform (dynamically configure scheduling classes, scheduling time, so that programs automatically perform certain services)
6. Lucene search engine, which can index documents and support document content search, keyword search, highlighted keywords, etc., so that the information can be extracted and queried in milliseconds.
7. User setting functions: including modifying user information, changing passwords, sending messages, modifying personal pictures, viewing roles, viewing user groups, administrators modifying roles, users, user groups, and so on.
8. Integrate Webservice platform, including jaxws service, CXF framework, configure double encryption authority authentication. Make service integration more secure.
9. Bootstrap html5 provides two sets of foreground environments, including CMS and e-commerce sites, to make your development more concise.
Technical points:
1. Springmvc + Mybatis integration, SpringSecurity permission control, Spring AOP transaction processing.
2. Wink Rest service, Webservice service: jaxws, CXF, etc.
3. IO stream uploads and downloads files and operates with multiple threads
4. Send mail, configure mail server, send mail based on html, plain text format
5. MD5 encryption (login password verification, encryption, etc.), unified Session, Cookie management, unified CAPTCHA verification, etc.
6. Unified configuration of database connection pool
7. Quartz scheduled task integration (directly through configuration)
8. Httpclient cracked the CAPTCHA and logged in to Unicom's recharge platform.
9. Chinese characters, English split, can be used as document keyword search and so on.
10. Base64 image processing, which supports PC,Android,IOS
11. Service Socket, Client Socket communication technology (GPRS data acquisition has been done and used in the project)
twelve。 Provides a large number of tool classes that can be used directly
13. Maven project building, you can directly do the architecture, you can improve your learning ability and make you a true architect.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.