- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试编写一个简单的 Spring Rest Web 服务,因为我不熟悉 Maven(并且因为 Maven 通常无法完成工作 - 连接问题),所以我现在正在尝试 ant 构建。现在,构建正常,服务可以运行。但如果触发持久化功能,则会提示:
01:48:39 Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'uncaughtException'; model is {exception=java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)} -org.springframework.web.servlet.DispatcherServlet
java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
at com.books.domain.UserInfo.entityManager(UserInfo.java:96)
at com.books.domain.UserInfo.findUserByNamePassword(UserInfo.java:157)
at com.books.web.UserController.register(UserController.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
我的ant build.xml:
<target name="compile" depends="init" description="compile the source ">
<!--<javac srcdir="${src}"
debug="on"
destdir="${build}"
classpathref="compile.classpath"
includeantruntime="false"/>-->
<iajc source ="1.6" target="1.6" sourceroots="src/main/java" destDir="src/main/webapp/WEB-INF/classes" showweaveinfo="true" verbose="true">
<classpath>
<path refid="compile.classpath"/>
<path refid="aspectj.classpath"/>
</classpath>
</iajc>
</target>
我的applicationContext.xml:
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
<property name="dataSource" ref="dataSource"/>
</bean>
任何帮助将不胜感激。谢谢!
最佳答案
我找到了解决方案:
这是正确的iajc任务
<iajc source ="1.6" target="1.6" sourceroots="src/main/java" destDir="src/main/webapp/WEB-INF/classes" showweaveinfo="true" verbose="true">
<classpath>
<path refid="compile.classpath"/>
<path refid="aspectj.classpath"/>
</classpath>
<aspectpath>
<pathelement location="${workdir}/WEB-INF/lib/spring-aspects-3.2.6.RELEASE.jar" />
</aspectpath>
</iajc>
关于spring - 实体管理器尚未注入(inject):is the Spring Aspects JAR configured as an AJC/AJDT aspects library?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10963310/
这里有几个问题: ajc 是否更改了它编译的所有类(甚至是非方面的)?如果我只编译方面类 ant 然后将它们与通用类放在同一个类路径中会怎样? ajc 编译的项目是否比使用加载时编织的项目执行得更快?
我正在尝试将 AspectJ 集成到现有项目中。编织后匿名静态类变为非静态。 例如这段代码: public class StaticCheck { public static void mai
我需要知道方面中 .jar 的名称,以便我可以通过 @DeclareParents 创建一个字符串字段。 我知道我可以将东西传递给 ajc 编译器,但是实际上可以使用方面传递的参数吗?最终结果应该是带
我写了两个简单的代码..一个 java 代码来打印一个 Hello World 语句,另一个是要编织到其中的方面代码.. 我的hello world代码是 // HelloWorld.java pub
当尝试使用 ajc 和命令行编译方面文件时,尝试编译 *.aj 文件(方面语法)时出现错误 编译 *.java 方面(使用注释)时工作正常 方面注释 - TestAspect.java: @Aspec
我正在尝试从 Java(不是 Maven 或 Ant!)运行 ajc 编译器。问题是我需要哪个 Maven 依赖项以及哪个类是入口点?我现在拥有的最佳选择是 org.aspectj:aspectjto
很多时候,当我更改我的 Maven 项目设置(添加/删除模块、更改配置文件、刷新依赖项)时,Idea 将 Java 编译器(在设置->构建->编译器->Java 编译器下)重置为 Ajc。 这很烦人,
既可以使用@AspectJ注解方式来定义方面,也可以使用AspectJ Java扩展语言,这需要我们使用ajc编译器。 人们想要使用注释样式而不是 ajc 的原因是什么?在我看来,使用注释样式放弃了很
我想在我的 IntelliJ Idea 中启用 AspectJ 编译器,因为我想在编译时编织几个方面。 同时,我在我的代码库中使用 Lombok 和 Mapstruct。 这两个需要额外的注释处理,必
我正在尝试将 ajc 编译器作为 gradle 插件添加到我的 gradle 项目中。不幸的是,在编译过程中,它向我显示了由于 Lombok 造成的大量错误。 构建.gradle: group 'co
如何用 ajc 替换 Eclipse 中的编译器,以便它在我编辑时进行编译? 最佳答案 您必须更具体地说明您希望发生的情况。我认为您正在寻找的术语是热切解析。在 JDT 中,文件不会在您键入时进行编译
我想解决我的问题。 http://www.eclipse.org/aspectj/doc/released/pdguide/messages.html建议首先将某些标志(例如 -verbose 或 -
我对 AspectJ 编译器 ajc 的工作方式有点困惑。根据我在谈论 CTW 时的理解,ajc 用于将方面编织到编译的字节码中 - 即:.class 文件。 但是,当我查看 AspectJ 的 ma
我正在使用 ajc 1.8、java 8 并遇到编译器问题。这是示例代码。 public class ExecutorTests { List tasks = Arrays.asList(
我的project Gradle 有一个有趣的问题。从 Intellij 13(Windows 或 Linux)内部运行“gradle build”时,我收到以下错误消息: 10:05:48 PM:
我不知所措......我已经按照Intro to AspectJ的步骤进行操作,但是当我尝试使用 ajc 编译示例时,我在之前、前后和之后的建议中收到“ajc:在学习中定义的建议。AccountAsp
我想知道在 IntelliJ 中使用 Ajc 编译器时是否有办法减少编译时间。我有一个相当大的项目,我想使用 AspectJ,但不幸的是,当我尝试使用它时,我发现 Ajc 需要太多时间来加载所有类,并
我在 IntelliJ 中使用 ajc 编译器,以及 aspectj-maven-plugin,我在其中声明以下排除项: org.codehaus.mojo
我正在尝试编写一个简单的 Spring Rest Web 服务,因为我不熟悉 Maven(并且因为 Maven 通常无法完成工作 - 连接问题),所以我现在正在尝试 ant 构建。现在,构建正常,服务
非常类似于this 2011 unanswered post 这很奇怪,当我在 eclipse 中运行应用程序时(调试与否)它工作得很好。当我尝试将应用程序与已部署的 war 一起使用时,问题就来了。
我是一名优秀的程序员,十分优秀!