Beans declared with spring annotation cannot be scanned when packaged in a jar

Source: Internet
Author: User

Found a problem, very egg ache.

Our project is composed of n projects, the periphery is the Web project, the internal engineering is packaged into jars, and put into the peripheral engineering Web-inf/lib

The internal engineering uses spring annotations, such as @service, @Controller, etc., can be scanned before hitting the jar package, but after the jar package, it will not be scanned, the report nosuchbeanexception

After searching the internet, I found a way to check the Add directory entries when using the Eclipse export jar.

This can be solved by hitting out the jar package, which can also be scanned into the jar package with the bean in the note declaration. If the Add directory entries is not checked, it will not be

Using the jar command, compare the difference between the two methods of the jar package,

You can see, tick the Add directory entries after the shot of the jar package, more information about the path, perhaps this is the difference


But now the problem is, we can not all use the manual export jar in the way of exporting the jar package, do not know in Maven, to configure what parameters of the plug-in to achieve the same effect,

Reference Blog: http://kyfxbl.iteye.com/blog/1675368

About Maven, I'm free to study.

Beans declared with spring annotation cannot be scanned when packaged in a jar

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.