首页 文章
  • 6 votes
     answers
     views

    无法让Intellij使用AspectJ编译器

    我在网上看到的所有内容都只是从编译器列表中选择“ajc”编译器,但这不是我的选择 . 我有javac,jikes,eclipse和javac-in-process,但就是这样 . 因为我的项目是使用maven从命令行编译的,但是如果我在使用方面的IDE中键入任何内容,我会收到编译器警告 .
  • 152 votes
     answers
     views

    Spring AOP vs AspectJ

    我的印象是Spring AOP最适合用于特定于应用程序的任务,例如安全性,日志记录,事务等,因为它使用自定义Java5注释作为框架 . 然而,AspectJ似乎更加友好的设计模式 . 任何人都可以强调在Spring应用程序中使用Spring AOP和AspectJ的各种优缺点吗?
  • 0 votes
     answers
     views

    Spring和AspectJ Logger

    我正在尝试使用注释记录创建一个小 Spring 天项目 . 首先我添加了Spring AOP xsd 和 namespace : xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/mvc ht...
  • 0 votes
     answers
     views

    Java设计模式示例[重复]

    可能重复:GoF设计模式的示例 对于一些大学工作,我正在以一种新的方式(使用AO)来实现设计模式 . 所以现在基本上需要找到一些在Java应用程序中使用设计模式(即适配器,代理,单例,工厂和观察者)的“真实”示例,以便隔离使用某个DP的代码的大部分内容所以尝试以不同的方式实现该部分 . 任何(不那么大)的java应用程序,java框架/库,github / googlecode项目都将非常感激...
  • 1 votes
     answers
     views

    转换器上的Spring Aspect

    我创建了一个简单的Aspect注释,用于测量带注释方法的执行时间 . 当我注释一个简单的Spring Bean的方法,注入bean,并像 bean.annotatedMethod() 一样运行它,一切正常 . 但是,当我在Spring Converter上注释 convert() 方法时,注释会被忽略 . 我猜测的原因是Spring的ConversionService在内部调用了 convert(...
  • 21 votes
     answers
     views

    在Spring AOP中使用代理

    我正在读一本关于在Spring AOP中启用AspectJ支持的书 . 以下是从该书中摘录的一段: 要在Spring IoC容器中启用AspectJ注释支持,您只需在bean配置文件中定义一个空的XML元素aop:aspectj-autoproxy . 然后,Spring将自动为您的AspectJ方面匹配的任何bean创建代理 . 对于接口不可用或未在应用程序设计中使用的情况,可以依靠CGLIB...
  • 29 votes
     answers
     views

    @Aspect方面的Spring autowired bean为null

    我有以下 spring 配置: <context:component-scan base-package="uk.co.mysite.googlecontactsync.aop"/> <bean name="simpleEmailSender" class="uk.co.mysite.util.email.simple.Simp...
  • 2 votes
     answers
     views

    Spring AOP:@AfterThrowing执行切入点从不匹配

    我对AOP完全不熟悉 . 我需要建议写出正确的切入点 . 我有一个包含所有服务类的服务包 . 所有类都实现 Service 接口 . 此接口有一个方法 save(entity) . 每次 service.save(entity) 方法抛出 DataIntegrityViolationException 时,我的建议都应该执行 . 这方面: @Component @Aspect public cl...
  • 8 votes
     answers
     views

    Spring - 带注释的构造函数对象的AspectJ切入点

    我正在使用Spring框架(4.0.5)和AspectJ进行AOP Logging开发一个java(JDK1.6)应用程序 . 我的Aspect类工作正常,但我无法为构造函数对象创建切入点 . 这是我的目标: @Controller public class ApplicationController { public ApplicationController(String myStri...
  • 0 votes
     answers
     views

    spring aspectj切入点可重用的类

    如https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html#aop-common-pointcuts所述 是否有可能创建一个定义所有切入点的独立类并在其他方面使用它,以便我们应该能够重用切入点? 如果我使用该类的切入点,我会收到一个错误: Caused by: java.lang.Ille...
  • 0 votes
     answers
     views

    使用AspectJS在Javascript中执行Node-RED JSON流程

    我的目标是通过检查某些属性在执行之前和之后是否有效来执行和测试一些Node-RED流 . 我知道存在一些方法来测试隔离中的一些节点,或者甚至通过使用注入到原始流中的辅助节点来测试一些流,例如, https://github.com/node-red/node-red-node-test-helper,但我想测试流程而不改变它 . 为此,我找到了一个实现JS范式范例的npm模块(https://ww...
  • 2 votes
     answers
     views

    spring @EnableRetry注释抛出错误'rg.springframework.aop.config.internalAutoProxyCreator'

    我创建了示例 Spring-boot 应用程序,它工作正常,没有任何错误, 现在我想练习 spring-retry 来重试一些方法 . 如果我不使用 @EnableRetry 我的应用程序启动没有任何错误但重试不起作用 . 如果我在配置类上使用 @EnableRetry ,我的应用程序无法启动 build.gradle apply plugin: 'java-library' repositor...
  • 0 votes
     answers
     views

    gradle aspectj - 编译错误编织外部jar

    我有一个项目,它使用编译时编织方面,它取决于两个外部jar . 我使用gradle-aspectj插件:https://github.com/eveoh/gradle-aspectj build.gradle如下: buildscript { repositories { maven { url "http://nexus.**.org/nexus/content...
  • 0 votes
     answers
     views

    Spring AspectJ没有调用loadtimeweaving

    Spring AspectJ加载时编织配置正在构建和加载服务器而没有任何错误,但是方面没有被调用 . 以下是配置列表1)JDK 8 2)Server Jetty @Configuration @ComponentScan(basePackages = {..}) @EnableSpringConfigured @EnableLoadTimeWeaving(aspectjWeaving=Aspect...
  • 1 votes
     answers
     views

    Springboot加载时编织不允许在使用devtools时将spring bean注入嵌入式Tomcat的方面

    我正在使用最新的springboot v1.5.2与aspectj(v1.8.10)加载时间编织 . 在外部tomcat上运行我的应用程序时,我能够将spring bean注入我的aspectj方面,现在我想知道为什么嵌入式tomcat的同样失败了? springboot: 1.5.2 Aspectj: 1.8.10 spring 仪表: 4.3.7.RELEASE maven命令: mvn sp...
  • 0 votes
     answers
     views

    为什么使用aspectjweaver javaagent的加载时间编织这么慢?

    我正在研究的项目相当庞大 . 在尝试为这个 Spring 季项目设计加载时间时,我被指示使用spring-instrument javaagent以及aspectjweaver javaagent . 但是,我注意到在使用aspectjweaver代理时,我的发布时间增加了4-6倍 . 我还可以看到来自ContextOverridingClassLoader的4-6次相同的编织消息 . 但是,如果...
  • 0 votes
     answers
     views

    EnableLoadTimeWeaving Spring Boot嵌入式Tomcat

    使用Spring Boot和嵌入式tomcat并启用了LoadTimeWeaving时,缓存方面在运行时没有任何影响,但我们看到日志中编织正常 . 下面是配置,启用LoadTimeWeaving以及作为高速缓存的AspectJ模式 @Configuration @EnableConfigurationProperties @EnableSpringConfigured @E...
  • 0 votes
     answers
     views

    Spring Boot aspectJ LTW无法使用spring-instrument javaagent编写方法

    我有这个配置的 Spring 季启动应用程序: @SpringBootApplication @EnableTransactionManagement(mode = AdviceMode.ASPECTJ) @EnableLoadTimeWeaving @EnableScheduling @EnableConfigurationProperties({TelegramBotProperties.cl...
  • 1 votes
     answers
     views

    Spring引导aspectj gradle编译时编织问题

    我有一本 spring 书应用程序,工作正常 . 如果从我的应用程序中抛出异常,我想向我发送电子邮件通知 . 我认为aspectj很合适 . 首先,我尝试使用Spring AOP运行时编织,它适用于公共方法 . 但是,我也希望获得有关私有方法的通知,并且我已经安排了任务 . 根据Spring AOP doc,运行时编织不适用于计划任务和私有方法 . 因此我决定在我的启动应用程序中使用aspectj...
  • 8 votes
     answers
     views

    @EnableAspectJAutoProxy不起作用

    我正在使用Spring Boot,我想使用AspectJ . 以下作品(当然): @Aspect @Component public class RequestMappingAspect { @Before("@annotation(org.springframework.web.bind.annotation.RequestMapping)") public...
  • 1 votes
     answers
     views

    Kotlin编译错误:未解析的AspectJ超类型

    我正在尝试在我的Kotlin项目中使用Java库 . 在库中定义的类型项目中创建变量工作正常,例如 val foo: Foo = fooProvider.get() ,但引入了实际使用这些类型的代码,例如: foo.toString() ,导致编译错误: Error:Kotlin: Supertypes of the following classes cannot be resolved. P...
  • 0 votes
     answers
     views

    使用spring aop切入点获取错误虽然我也添加了aspectjrt.jar

    无法解决此问题错误: java.lang.IllegalStateException:ContainerBase.addChild:start:org.apache.catalina.LifecycleException:javax.xml.parsers.FactoryConfigurationError:org.apache.catalina.core中找不到提供者org.apache.xe...
  • 6 votes
     answers
     views

    aspectj和spring with aspectj-autoproxy

    我已经使用@Aspect注释声明了我的方面,但建议似乎没有得到应用 . 该方面适用于我所拥有的其他一些项目,关键区别似乎是其他项目使用注释完全连线,这个特定项目是xml有线 . 连接注释的唯一bean是Aspect . 所以我想知道spring的aspectj是否支持,当使用aspectj-autoproxy时,对于在xml中定义bean的顺序很敏感 . 例如,将xml中的aspectj-auto...
  • 5 votes
     answers
     views

    Spring AOP代理无法按预期工作

    实际上我对 spring 代理的行为感到困惑 . 我想我知道j2ee,cglib和aspectj的代理机制之间的主要区别 . 我在配置类中启用了aspectj自动代理,并且aspectj包含在类路径中 . 我的配置 @Configuration @EnableAspectJAutoProxy(proxyTargetClass = true) public class ApplicationConf...
  • 0 votes
     answers
     views

    Spring-Boot 2 AspectJ加载时间编织

    我正在试验Spring Boot 2和AspectJ Load Time Weaving . 我可以从Eclipse运行测试和应用程序(将两个代理程序:aspectjweaver和spring-instrument添加到VM),来自Maven的surefire也运行正常,但是我无法将两个代理添加到spring-boot-maven-plugin . 这是我的pom.xml片段 <plugin...
  • 0 votes
     answers
     views

    AspectJ for Logger on File

    我正在尝试使用AspectJ创建日志文件,输出应该写入文件,日志文件具有特定的语法: START "THREAD_ID";"METHOD_NAME";"begin_or_end METHOD";"instant time" STOP 代码不起作用:( 你可以帮助我? import java.io.File; im...
  • 2 votes
     answers
     views

    如何让Spring @Cacheable在AspectJ方面工作?

    我创建了一个AspectJ方面,它在spring应用程序中运行良好 . 现在我想使用spring Cacheable注释添加缓存 . 要检查@Cacheable是否被选中,我使用的是不存在的缓存管理器的名称 . 常规运行时行为是抛出异常 . 但在这种情况下,不会抛出任何异常,这表明@Cacheable注释未应用于拦截对象 . /* { package, some more imports... }...
  • 3 votes
     answers
     views

    使用AspectJ的新手:无法调用方面

    所以,当我的域中对象的状态发生变化时,我开始考虑使用AspectJ来处理处理事件 . 实际上,我想写一些包含我域中所有setter方法的建议 . 调用通知时,它将检查所设置字段的初始值,运行setter,然后在setter执行后检查该值 . 如果值发生更改,它将向事件侦听器触发事件,通知更改 . 我使用了这里找到的教程:http://www.andrewewhite.net/wordpress/2...
  • 5 votes
     answers
     views

    带有spring cache和aspectj的NoClassDefFoundError

    我在 Spring 季webapp( Spring 季3.1)中收到此错误,我不知道为什么 . org.springframework.web.util.NestedServletException:处理程序处理失败;嵌套异常是java.lang.NoClassDefFoundError:mypackage / TestCache $ AjcClosure1 ( $AjcClosure1 很奇...
  • 2 votes
     answers
     views

    spring 缓存和aspectj

    我想对不受spring管理的对象使用@cacheable注释 . 我正在使用maven-aspectj编译器来编译类 . 但我没有看到任何编织 . 我没有@ Aspect,因为我假设spring应该为所有缓存相关的注释处理这个问题 . 我的配置文件中有以下内容 . 谷歌搜索后我做了几个改变 <cache:annotation-driven mode="aspectj"/&...

热门问题