Removing redundant dependencies / using jboss bom

Most of the dependencies that were in the pom were not needed and were
in the wrong scope to begin with. This uses the Wildfly BOM (bill of
materials) to specify the correct versions (and scopes) for Wildfly
8.1.0.Final.
Removing unnecessary attributes in persistence.xml
Adding basic beans.xml content

You don't have to have this, but it helps keep things portable.
Fixing injections

You can't have @RequestScoped Stateless Session Beans (SLSB), so I just
left them as dependent (no scope annotation), which for what they're
doing is probably fine. I've changed the scope of some of the other
things so we're not leaking objects into longer living scopes.

I've also fixed up injections where needed. The reason the
HttpServletRequest was null was because the object containing the
injection was manually created, instead of being created by the
container using injection. If you want container managed services
(transactions, injections, security, etc.) you have to let the container
create the objects.
diff --git
a/src/main/java/edu/neumont/diyauto/Controllers/AccountController.java
b/src/main/java/edu/neumont/diyauto/Controllers/AccountController.java
index 9945c62..29db734 100644 ---
a/src/main/java/edu/neumont/diyauto/Controllers/AccountController.java
+++
b/src/main/java/edu/neumont/diyauto/Controllers/AccountController.java
@@ -1,23 +1,21 @@ package edu.neumont.diyauto.Controllers;

-import javax.ejb.LocalBean;
-import javax.ejb.Stateless;
+import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
-import javax.inject.Named;
 import javax.servlet.http.HttpServletRequest;
+
 import edu.neumont.diyauto.Framework.UrlMapping;
 import edu.neumont.diyauto.Models.ModelAndView;
 import edu.neumont.diyauto.Services.AccountService;
 import edu.neumont.diyauto.security.PasswordEncoder;

-@Stateless
-@LocalBean
+@RequestScoped
 public class AccountController  {
 	@Inject AccountService accountService;
 	@Inject HttpServletRequest request;
 	@Inject PasswordEncoder passwordEncoder;
-
+
 	@UrlMapping(value="/account", method="POST")
 	public ModelAndView executeCreateAccount() {
 		String username = request.getParameter("username");
@@ -26,9 +24,9 @@ public class AccountController  {
 //		Account account = new Account();
 //		account.setUsername(username);
 //		account.setPassword(passwordEncoder.encode(password));
-//
+//
 //		accountService.updateAccount(account);
-//
+//
 //		return new ModelAndView(null, request.getContextPath() + "/app/student/list", true);
 		return null;
 	}
@@ -38,4 +36,4 @@ public class AccountController  {
 		return new ModelAndView(null, "/WEB-INF/account/edit.jsp");
 	}

-}
\ No newline at end of file
+}
diff --git a/src/main/java/edu/neumont/diyauto/ThreadServlet.java b/src/main/java/edu/neumont/diyauto/ThreadServlet.java
index 31876cb..003d404 100644
--- a/src/main/java/edu/neumont/diyauto/ThreadServlet.java
+++ b/src/main/java/edu/neumont/diyauto/ThreadServlet.java
@@ -1,10 +1,8 @@
 package edu.neumont.diyauto;

-import edu.neumont.diyauto.Models.ModelAndView;
-import edu.neumont.diyauto.diyautoControllers.PostGetController;
-import edu.neumont.diyauto.diyautoControllers.PostPostController;
-import edu.neumont.diyauto.diyautoControllers.ThreadGetController;
-import edu.neumont.diyauto.diyautoControllers.ThreadPostController;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;

 import javax.inject.Inject;
 import javax.servlet.RequestDispatcher;
@@ -13,9 +11,12 @@ import javax.servlet.annotation.WebServlet;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+
+import edu.neumont.diyauto.Models.ModelAndView;
+import edu.neumont.diyauto.diyautoControllers.PostGetController;
+import edu.neumont.diyauto.diyautoControllers.PostPostController;
+import edu.neumont.diyauto.diyautoControllers.ThreadGetController;
+import edu.neumont.diyauto.diyautoControllers.ThreadPostController;

 /**
  * Created by jjensen on 5/28/14.
@@ -32,6 +33,12 @@ public class ThreadServlet extends HttpServlet {
     private static final Pattern P7 = Pattern.compile("(/threads/)([0-9]+)(/post/)([0-9]+)");
     private static final Pattern P8 = Pattern.compile("(/threads/)([0-9]+)(/post/)(create)");

+    @Inject
+    ThreadPostController tpc;
+
+    @Inject
+    PostPostController ppc;
+
     @Override
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         ModelAndView MAV = getURIParser(request, response);
@@ -109,8 +116,6 @@ public class ThreadServlet extends HttpServlet {

     public ModelAndView PostURIParser(HttpServletRequest request, HttpServletResponse response)
     {
-        ThreadPostController tpc = new ThreadPostController();
-        PostPostController ppc = new PostPostController();
         String URI = request.getRequestURI();
         ModelAndView MAV = null;
         Matcher match = this.P.matcher(URI);//threads
diff --git a/src/main/java/edu/neumont/diyauto/diyautoControllers/PostGetController.java b/src/main/java/edu/neumont/diyauto/diyautoControllers/PostGetController.java
index b04a48d..e7249b2 100644
--- a/src/main/java/edu/neumont/diyauto/diyautoControllers/PostGetController.java
+++ b/src/main/java/edu/neumont/diyauto/diyautoControllers/PostGetController.java
@@ -1,22 +1,19 @@
 package edu.neumont.diyauto.diyautoControllers;

+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+
 import edu.neumont.diyauto.Models.ModelAndView;
 import edu.neumont.diyauto.Models.PostModel;
 import edu.neumont.diyauto.Models.ThreadsModel;
 import edu.neumont.diyauto.Services.PostsService;
 import edu.neumont.diyauto.Services.ThreadsService;

-import javax.ejb.LocalBean;
-import javax.ejb.Stateless;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-@Stateless
-@LocalBean
+@RequestScoped
 public class PostGetController
 {
-    HttpServletRequest request;
-    HttpServletResponse response;
+    @Inject HttpServletRequest request;
     @Inject ThreadsService threadsService;
     @Inject PostsService postsService;

diff --git a/src/main/java/edu/neumont/diyauto/diyautoControllers/PostPostController.java b/src/main/java/edu/neumont/diyauto/diyautoControllers/PostPostController.java
index 10e6662..0a43220 100644
--- a/src/main/java/edu/neumont/diyauto/diyautoControllers/PostPostController.java
+++ b/src/main/java/edu/neumont/diyauto/diyautoControllers/PostPostController.java
@@ -1,5 +1,9 @@
 package edu.neumont.diyauto.diyautoControllers;

+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+
 import edu.neumont.diyauto.Models.CommentModel;
 import edu.neumont.diyauto.Models.ModelAndView;
 import edu.neumont.diyauto.Models.PostModel;
@@ -8,14 +12,7 @@ import edu.neumont.diyauto.ServiceLoader;
 import edu.neumont.diyauto.Services.PostsService;
 import edu.neumont.diyauto.Services.ThreadsService;

-import javax.ejb.LocalBean;
-import javax.ejb.Stateless;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.servlet.http.HttpServletRequest;
-
-@Stateless
-@LocalBean
+@RequestScoped
 public class PostPostController
 {
     @Inject ThreadsService threadsService;
diff --git a/src/main/java/edu/neumont/diyauto/diyautoControllers/ThreadGetController.java b/src/main/java/edu/neumont/diyauto/diyautoControllers/ThreadGetController.java
index 1c95777..7d52a88 100644
--- a/src/main/java/edu/neumont/diyauto/diyautoControllers/ThreadGetController.java
+++ b/src/main/java/edu/neumont/diyauto/diyautoControllers/ThreadGetController.java
@@ -1,17 +1,15 @@
 package edu.neumont.diyauto.diyautoControllers;

-import javax.ejb.LocalBean;
-import javax.ejb.Stateless;
+import java.util.Collection;
+
+import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;

 import edu.neumont.diyauto.Models.ModelAndView;
 import edu.neumont.diyauto.Models.ThreadsModel;
 import edu.neumont.diyauto.Services.ThreadsService;
-
-import java.util.Collection;
-@Stateless
-@LocalBean
-public class ThreadGetController
+@RequestScoped
+public class ThreadGetController
 {
     @Inject ThreadsService threadService;

@@ -26,15 +24,15 @@ public class ThreadGetController

 		ModelAndView MAV = new ModelAndView(null, "/WEB-INF/views/threads/CreateThread.jsp");
 		return MAV;
-
+
 	}
 	public ModelAndView getThread(int ID)
 	{
 		ThreadsModel thread = threadService.getThread(ID);
 		ModelAndView MAV = new ModelAndView(thread, "/WEB-INF/views/threads/ThreadView.jsp");
 		return MAV;
-
+
 	}
-
-
+
+
 }
diff --git a/src/main/java/edu/neumont/diyauto/diyautoControllers/ThreadPostController.java b/src/main/java/edu/neumont/diyauto/diyautoControllers/ThreadPostController.java
index 8d5f64c..58da545 100644
--- a/src/main/java/edu/neumont/diyauto/diyautoControllers/ThreadPostController.java
+++ b/src/main/java/edu/neumont/diyauto/diyautoControllers/ThreadPostController.java
@@ -1,21 +1,16 @@
 package edu.neumont.diyauto.diyautoControllers;

-import javax.ejb.LocalBean;
-import javax.ejb.Stateless;
-import javax.enterprise.inject.Default;
+import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
-import javax.inject.Named;
 import javax.servlet.http.HttpServletRequest;

 import edu.neumont.diyauto.Models.ModelAndView;
-import edu.neumont.diyauto.Models.Test;
 import edu.neumont.diyauto.Models.ThreadsModel;
 import edu.neumont.diyauto.Services.ThreadsService;

-@Stateless
-@LocalBean
+@RequestScoped
 public class ThreadPostController {
-    ThreadsService threadService;
+    @Inject ThreadsService threadService;
     @Inject HttpServletRequest request;

 	public ModelAndView createThread()
@@ -30,14 +25,14 @@ public class ThreadPostController {
         threadService.updateThread(thread);
 		ModelAndView MAV = new ModelAndView(thread, "/threads/" + thread.getIdThreads());
 		return MAV;
-
+
 	}
 	public ModelAndView getThread(int ID)
 	{
 		ThreadsModel thread = threadService.getThread(ID);
 		ModelAndView MAV = new ModelAndView(thread, "/WEB-INF/ThreadView/" + ID + ".jsp");
 		return MAV;
-
+
 	}