实体管理器尚未注入(Spring Aspects JAR是否配置为AJC / AJDT方面库?)

时间:2014-09-04 21:51:50

标签: java eclipse spring maven entitymanager

每次运行时都有弹簧应用程序,我尝试登录后登录后获得以下操作

java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
    at com.emc.fleet.domain.User_Roo_Jpa_ActiveRecord.ajc$interMethod$com_emc_fleet_domain_User_Roo_Jpa_ActiveRecord$com_emc_fleet_domain_User$entityManager(User_Roo_Jpa_ActiveRecord.aj:19)
    at com.emc.fleet.domain.User.entityManager(User.java:1)
    at com.emc.fleet.domain.User_Roo_Jpa_ActiveRecord.ajc$interMethodDispatch1$com_emc_fleet_domain_User_Roo_Jpa_ActiveRecord$com_emc_fleet_domain_User$entityManager(User_Roo_Jpa_ActiveRecord.aj)
    at com.emc.fleet.domain.User_Roo_Finder.ajc$interMethod$com_emc_fleet_domain_User_Roo_Finder$com_emc_fleet_domain_User$findUsersByUserIdEquals(User_Roo_Finder.aj:47)
    at com.emc.fleet.domain.User.findUsersByUserIdEquals(User.java:1)

我已阅读了许多STO问题并检查了所有答案,但没有一个成功

这是我的用户类

        package com.emc.fleet.domain
        import javax.persistence.EnumType;
        import javax.persistence.Enumerated;
        import javax.persistence.GeneratedValue;
        import javax.persistence.Id;
        import javax.persistence.JoinColumn;
        import javax.persistence.OneToOne;
        import javax.persistence.Transient;
        import javax.validation.constraints.NotNull;
        import org.hibernate.validator.constraints.Email;
        import org.hibernate.validator.constraints.NotEmpty;
        import org.springframework.roo.addon.javabean.RooJavaBean;
        import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
        import org.springframework.roo.addon.tostring.RooToString;

        @RooJavaBean
        @RooToString

    @RooJpaActiveRecord(finders = { "findUsersByEmailLike", "findUsersByUserIdEquals", "findUsersByCostCenter", "findUsersByDepartmet" })

public class User {

    @Id
    @GeneratedValue
    private Long id;

    @NotEmpty
    @NotNull
    private String firstName;

    @NotEmpty
    @NotNull
    private String lastName;

    @NotNull
    private Long userId;

    @Email
    @NotNull
    private String email;

    @NotNull
    private String address;

    @NotNull
    private String district;

    private String deskPhone;

    @NotEmpty
    @NotNull
    private String mobile;

    @NotEmpty
    @NotNull
    private String password;

    @Transient
    private String retypePassword;

    @OneToOne
    private Department departmet;

    @OneToOne
    @JoinColumn(name = "cost_center")
    private CostCenter costCenter;

    private String managerName;

    private boolean enabled = true;

    @Enumerated(EnumType.STRING)
    private Roles role = Roles.ROLE_USER;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }

    public String getDeskPhone() {
        return deskPhone;
    }

    public void setDeskPhone(String deskPhone) {
        this.deskPhone = deskPhone;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRetypePassword() {
        return retypePassword;
    }

    public void setRetypePassword(String retypePassword) {
        this.retypePassword = retypePassword;
    }

    public Department getDepartmet() {
        return departmet;
    }

    public void setDepartmet(Department departmet) {
        this.departmet = departmet;
    }

    public CostCenter getCostCenter() {
        return costCenter;
    }

    public void setCostCenter(CostCenter costCenter) {
        this.costCenter = costCenter;
    }

    public String getManagerName() {
        return managerName;
    }

    public void setManagerName(String managerName) {
        this.managerName = managerName;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public Roles getRole() {
        return role;
    }

    public void setRole(Roles role) {
        this.role = role;
    }

    @Override
    public String toString() {
        return getEmail() + " - " + getUserId();
    }
}

这是user_Roo_Configurable文件

package com.emc.fleet.domain;

import com.emc.fleet.domain.User;
import org.springframework.beans.factory.annotation.Configurable;

privileged aspect User_Roo_Configurable {

    declare @type: User: @Configurable;

}

任何线索?

0 个答案:

没有答案