RuntimeException: MemberAccess implementation must be provided

前端 未结 1 1333
渐次进展
渐次进展 2021-01-27 14:17

I am using a template which accesses public fields of a Customer object like this:

相关标签:
1条回答
  • 2021-01-27 14:37

    As @Ahmet stated in the comments, I do not need any additional OGNL dependencies. Would've surprised me anyway. The problem was, that my model class looked like this:

    public class Customer {
        public String addressee;
        public String street;
        public String postalCode;
        public String city;
        public String country;
    }
    

    I was not aware, that there are explicit public getter methods required. I had to change the model to

    public class Customer {
        private String addressee;
        private String street;
        private String postalCode;
        private String city;
        private String country;
    
        public String getAddressee() {
            return addressee;
        }
    
        public void setAddressee(String addressee) {
            this.addressee = addressee;
        }
    
        public String getPostalCode() {
            return postalCode;
        }
    
        public void setPostalCode(String postalCode) {
            this.postalCode = postalCode;
        }
    
        public String getStreet() {
            return street;
        }
    
        public void setStreet(String street) {
            this.street = street;
        }
    
        public String getCountry() {
            return country;
        }
    
        public void setCountry(String country) {
            this.country = country;
        }
    
        public String getCity() {
            return city;
        }
    
        public void setCity(String city) {
            this.city = city;
        }
    }
    

    In order to make it work.

    0 讨论(0)
提交回复
热议问题