From a8b4dd666feb883f32f86154114e8154aed3fdfa Mon Sep 17 00:00:00 2001 From: Carlus Henry Date: Mon, 9 Feb 2015 21:30:28 -0500 Subject: [PATCH] fixes #15 --- pom.xml | 2 +- .../com/ioextendedgr/web/Application.java | 15 ++++ .../web/controller/ConferenceController.java | 1 + src/main/java/hello/Application.java | 28 ------- .../hello/controller/GreetingController.java | 32 -------- src/main/java/hello/model/Greeting.java | 20 ----- src/main/java/hello/model/User.java | 80 ------------------- .../java/hello/repository/UserRepository.java | 8 -- 8 files changed, 17 insertions(+), 169 deletions(-) create mode 100755 src/main/java/com/ioextendedgr/web/Application.java delete mode 100755 src/main/java/hello/Application.java delete mode 100755 src/main/java/hello/controller/GreetingController.java delete mode 100755 src/main/java/hello/model/Greeting.java delete mode 100644 src/main/java/hello/model/User.java delete mode 100644 src/main/java/hello/repository/UserRepository.java diff --git a/pom.xml b/pom.xml index a2803d9..de759df 100755 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ - hello.Application + com.ioextendedgr.web.Application 1.7 9.1.0.v20131115 3.1.0 diff --git a/src/main/java/com/ioextendedgr/web/Application.java b/src/main/java/com/ioextendedgr/web/Application.java new file mode 100755 index 0000000..0d06059 --- /dev/null +++ b/src/main/java/com/ioextendedgr/web/Application.java @@ -0,0 +1,15 @@ +package com.ioextendedgr.web; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; + +@ComponentScan(basePackages = {"com.ioextendedgr.web"}) +@EnableAutoConfiguration +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/src/main/java/com/ioextendedgr/web/controller/ConferenceController.java b/src/main/java/com/ioextendedgr/web/controller/ConferenceController.java index 3bac6fe..209a6fd 100644 --- a/src/main/java/com/ioextendedgr/web/controller/ConferenceController.java +++ b/src/main/java/com/ioextendedgr/web/controller/ConferenceController.java @@ -9,6 +9,7 @@ import com.ioextendedgr.web.viewDto.ConferenceView; @RestController +@RequestMapping("/api") public class ConferenceController { @RequestMapping("/conference") diff --git a/src/main/java/hello/Application.java b/src/main/java/hello/Application.java deleted file mode 100755 index b1aeff3..0000000 --- a/src/main/java/hello/Application.java +++ /dev/null @@ -1,28 +0,0 @@ -package hello; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; - -@ComponentScan(basePackages = {"hello", "com.ioextendedgr.web"}) -@EnableAutoConfiguration -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -// @Bean -// public InitializingBean poopulateTestData(final UserRepository userRepository) { -// return new InitializingBean() { -// @Override -// public void afterPropertiesSet() throws Exception { -// userRepository.save(new User("Dan", "Mikita")); -// userRepository.save(new User("Carlus", "Henry")); -// userRepository.save(new User("Eric", "Fox")); -// } -// }; -// -// } - -} diff --git a/src/main/java/hello/controller/GreetingController.java b/src/main/java/hello/controller/GreetingController.java deleted file mode 100755 index ef9ff7d..0000000 --- a/src/main/java/hello/controller/GreetingController.java +++ /dev/null @@ -1,32 +0,0 @@ -package hello.controller; - -import hello.model.Greeting; -import hello.model.User; -import hello.repository.UserRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.concurrent.atomic.AtomicLong; - -@RestController -public class GreetingController { - - @Autowired - private UserRepository userRepository; - - private static final String template = "Hello, %s!"; - private final AtomicLong counter = new AtomicLong(); - - @RequestMapping("/greeting") - public Greeting greeting(@RequestParam(value = "name", required = false, defaultValue = "World") String name) { - return new Greeting(counter.incrementAndGet(), - String.format(template, name)); - } - - @RequestMapping(value = "/user") - public Iterable findAllUsers() { - return userRepository.findAll(); - } -} diff --git a/src/main/java/hello/model/Greeting.java b/src/main/java/hello/model/Greeting.java deleted file mode 100755 index 443a436..0000000 --- a/src/main/java/hello/model/Greeting.java +++ /dev/null @@ -1,20 +0,0 @@ -package hello.model; - -public class Greeting { - - private final long id; - private final String content; - - public Greeting(long id, String content) { - this.id = id; - this.content = content; - } - - public long getId() { - return id; - } - - public String getContent() { - return content; - } -} diff --git a/src/main/java/hello/model/User.java b/src/main/java/hello/model/User.java deleted file mode 100644 index 7fc7a85..0000000 --- a/src/main/java/hello/model/User.java +++ /dev/null @@ -1,80 +0,0 @@ -package hello.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(schema="conf_admin", name = "user_xyz") -public class User { - - @Id - @Column(name = "id", unique = true, nullable = false, insertable=false) - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(nullable = false) - private String firstName; - - @Column(nullable = false) - private String lastName; - - @Column(nullable = false) - private String userName; - - @Column(nullable = false) - private String password; - - public User() { - } - - public User(String firstName, String lastName) { - this.firstName = firstName; - this.lastName = lastName; - this.userName = firstName + "_" + lastName; - this.password = lastName; - } - - 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 Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } -} diff --git a/src/main/java/hello/repository/UserRepository.java b/src/main/java/hello/repository/UserRepository.java deleted file mode 100644 index c3cb9fb..0000000 --- a/src/main/java/hello/repository/UserRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package hello.repository; - -import hello.model.User; -import org.springframework.data.repository.CrudRepository; - -public interface UserRepository extends CrudRepository { - -}