How to scan classes for annotations?

前端 未结 7 2061
野性不改
野性不改 2020-12-28 17:00

I have a plain jane servlets web application, and some of my classes have the following annotations:

@Controller
@RequestMapping(name = \"/blog/\")
public cl         


        
7条回答
  •  囚心锁ツ
    2020-12-28 17:42

    Scanning for annotations is very difficult. You actually have to process all classpath locations and try to find files that correspond to Java classes (*.class).

    I strongly suggest to use a framework that provides such functionality. You could for example have a look at Scannotation.

提交回复
热议问题