如何自定义 AspectJ aop.xml 位置? [英] How can I custom AspectJ aop.xml location?
问题描述
我有与此相关的相同问题:aop.xml 名称和位置?
I have the same question related to this: aop.xml name and location?
在答案中,它说:
使用系统属性:-D org.aspectj.weaver.loadtime.configuration=META-INF/myaop.xml
use the system property: -D org.aspectj.weaver.loadtime.configuration=META-INF/myaop.xml
使用系统属性"是什么意思?
What does "use the system property" mean?
创建一个 aop.properties 文件?或者,写在vm选项中?
create a aop.properties file? Or, write in the vm option?
推荐答案
AFAIK 没有 aop.properties 这样的东西.你是刚刚编的吗?提示意味着您应该像这样将属性指定为 JVM 命令行参数,如果给定的路径可以解析为 Java 资源路径/URL:
AFAIK there is no such thing as aop.properties. Have you just made this up? The hint means you should specify the property as a JVM command line parameter like this, if the given path can be resolved as a Java resource path/URL:
java ... -Dorg.aspectj.weaver.loadtime.configuration=META-INF/myaop.xml ...
如果要明确指向文件系统,则必须在路径前加上file:
,例如
If you explicitly want to point to the file system, you have to precede the path by file:
, e.g.
java ... -Dorg.aspectj.weaver.loadtime.configuration=file:META-INF/myaop.xml ...
或
java ... -Dorg.aspectj.weaver.loadtime.configuration=file:c:\my\path\META-INF\myaop.xml ...
注意:-D
和属性名称之间没有空格!
Attention: no white space between -D
and the property name!
更新:
什么是使用系统属性"?是什么意思?
What does "use the system property" mean?
您最喜欢的搜索引擎会将您引导至以下页面:
Your favourite search engine will lead you to pages like:
- Oracle Java 教程
系统
Javadoc,特别是方法getProperties()
,getProperty(String)
,getProperty(String, String)
,setProperties(Properties)
,setProperty(String, String)
,clearProperty()
- Oracle Java tutorial
System
Javadoc, specifically methodsgetProperties()
,getProperty(String)
,getProperty(String, String)
,setProperties(Properties)
,setProperty(String, String)
,clearProperty()
这篇关于如何自定义 AspectJ aop.xml 位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!