cs544.blog.App.java Source code

Java tutorial

Introduction

Here is the source code for cs544.blog.App.java

Source

package cs544.blog;

import cs544.blog.entities.Post;
import cs544.blog.entities.User;

import cs544.blog.service.IBlogService;

import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author ajay
 */
public class App {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("springconfig.xml");
        IBlogService blogService = context.getBean("blogService", IBlogService.class);
        //  IPostService postService = new PostService();
        User user = blogService.createUser("ajay", "ajay");
        //blogService.createPost(user.getId(), "ha", "ta");
        Post post = blogService.createPost(user.getId(), "asd  ", "asdf");
        //  blogService.updatePost(post);
        //        
        //        List<User> users = blogService.getAllUser();
        //        for (User user:users){
        //            System.out.println(user);
        //        }

    }

}