[Shiro Study notes] section III using MYECLIPSE to import Quikstart example example in Apache Shiro

Source: Internet
Author: User

This address: http://blog.csdn.net/sushengmiyan/article/details/40149131

Shiro Official Website: http://shiro.apache.org/

Shiro Chinese Manual: Http://wenku.baidu.com/link?url=ZnnwOHFP20LTyX5ILKpd_P94hICe9Ga154KLj_ 3ccdxpjwhw5evxt7sfr0b5qszyxokqg_fthed-rwqvi5ozytbrmaalhh8nfxnzyoow21k

Shiro Official first example of experience: http://shiro.apache.org/tutorial.html

Example svn:https://svn.apache.org/repos/asf/shiro/trunk/samples/quickstart/

This article Sushengmiyan

--------------------------------------------------------------------------------------------------------------- ---------------------


First step: Download the official example

Using SVN download, if you are not familiar with SVN students can refer to http://blog.csdn.net/sushengmiyan/article/details/7437446

Or go to Shiro's download page: http://shiro.apache.org/download.html download Shiro-root-1.2.3-source-release.zip

Unzip the folder, get the example folder, find the inside of the Quikstat project can


Step two: MyEclipse import maven Project:

Note: Before importing, it is necessary to configure Maven in myeclipse First, download, test, install. This step, please first move http://blog.csdn.net/sushengmiyan/article/details/40142771

In MyEclipse, select Maven4myeclipse


After the dialog box pops up, fill in the directory of the example you just got (to the. pom file) into root directory


Next finish ignores pop-up prompts.

If you find that the import is unsuccessful, you need to edit the Pom file, locate the Name property, and remove the inside:.


If you import normally, look at your project and discover that your project is now automatically adding MAVEN-dependent packages.


This is the benefit of using MAVEN, instead of downloading the package yourself and importing it, just add maven dependencies.


In MyEclipse, navigate to Pom.xml, right-click and select Run as Maven build. Pop-up execution popup, write compile in goal, execute


See execution succeed.

Continue with the above steps, this time write Exec:java in goal, we expect to see the log output of Shiro. Just like the main method of executing java.

This time unexpectedly, the error. Look at the following information:

slf4j:failed to load Class "Org.slf4j.impl.StaticLoggerBinder".
Slf4j:defaulting to No-operation (NOP) Logger implementation
Slf4j:see Http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.



This is due to no dependency on adding log4j. We need to add this dependency to Maven and do the following:

Opens a. pom file and joins a new dependency in dependencies

<dependency>          <groupId>org.slf4j</groupId>          <artifactid>slf4j-log4j12</ artifactid>          <version>1.7.7</version>  <scope>test</scope></dependency>
Save.

Then recompile and re-execute the Exec:java

You can see that the program is running correctly.


001


002


The output information of Apache Shiro is the information you output in the Java file.



[Shiro Study notes] section III using MYECLIPSE to import Quikstart example example in Apache Shiro

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.