Tim Nachreiner

Ranch Hand
+ Follow
since Apr 28, 2011
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Nachreiner

This link may be of interest to you, especially item 4:    https://www.baeldung.com/spring-postconstruct-predestroy
1 month ago
Can you run your unit tests without this "extra" .xml file?
Sometimes a different .xml file is created for unit testing.
5 months ago
I'm assuming you have an architecture like this: TodoController ==> TodoService ==> TodoDao.
If so, TodoController should handle all CRUD operations on your Todo entity.  Why would you have another controller that performs CRUD operations on the Todo entity?

If you DID have another controller that performed CRUD operations on the Todo entity, that controller could still use the TodoService and TodoDao layers; eliminating the need for duplicate code.

I get the feeling you are looking for a 'Spring-based' solution to your problem in order to learn Spring, but based on your requirements, a database trigger on the Todo table may be more appropriate.
6 months ago
9 months ago
What tool are you using to develop the Angular piece?
10 months ago
I viewed your source code and was impressed.
Is this a tutorial you are following?
If so, would you share the link?
10 months ago
Here's a better solution:

11 months ago
I forgot the braces on the getPrincipal function.....

model.addAttribute("user", userService.getUser(authentication.getPrincipal().getName()));
11 months ago
I'm guessing it's something in the UserController.
Line 11 looks suspicious; it doesn't return anything.
Try this:
comment out line 11
change line 12 to model.addAttribute("user", userService.getUser(authentication.getPrincipal.getName()));
11 months ago

Here is a series of steps that will fix your problem:

1. Use a better naming convention; ie, stick to camel-case.  Rename your interfaces to: UserDao, UserService.
2. Even though you are autowiring UserDao twice, you still use the singleton instance created by the Spring container.
3. Remove @Qualifier annotation; it is not needed.
4. Remove line 41 from db-config.xml, since Component scanning will create this bean anyway.
5. In Web.xml remove lines 38-41.  You've already created a ContextLoaderListener in lines 20-23
11 months ago
Your closing head tag </head> needs to be as shown below.  Your code appears to have wrapped the body tags within the head tags, which is incorrect.

11 months ago
You need to use Maven to manage your .jar files.  It dramatically simplifies things.  
JavaBrains has some free tutorials on YouTube regarding using Maven with Spring.
1 year ago
Yes, you can mix.
In Spring MVC, I have used an .xml config file, while annotating components with @Controller, @Service and @Repository.
1 year ago
I'd try removing this line:

1 year ago