Announcement Announcement Module
Collapse
No announcement yet.
swf-booking-faces / Dependency Injection Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • swf-booking-faces / Dependency Injection

    I'm following the swf-booking-faces example application. In the comments section inside the JPABookingService class it states: "The EntityManager reference is provided by the managing container (Spring) automatically"

    Can somebody explain to me how the EntityManager reference is provided automatically?

    I have a class similar to JPABookingService class minus the JPA implemetation. Eventually, I want to automatically add a reference to my javax.sql.DataSource the same as the example booking app does.

    As a basic test I put the following in my application context config file:

    Code:
    <bean class="test.package.ReportServiceImpl">
        	<property name="query" value="test" />
      	</bean>

    Here is my implementation of JPABookingService

    Code:
    @Service("reportService")
    @Repository
    public class ReportServiceImpl implements ReportService {
    
        private String query;
       
        
        
        @SuppressWarnings(value={"unchecked"})
        public String getReport(SearchCriteria criteria)  {
            return "called getReport with: " + criteria.getVal() + " query=" + query;
        }
        
        
        public void setQuery(String query)
        {
            this.query = query;
        }
    
    }
    I thought when I accessed ReportServiceImpl the query parameter would be automatically referenced from my xml config file where it was set to "test". A null value is returned instead.

    What am I missing?

  • #2
    can anyone point me in the right direction?

    Comment

    Working...
    X