Skip to content

Commit 0a766d2

Browse files
removed unused imports
1 parent e55c250 commit 0a766d2

File tree

5 files changed

+5
-41
lines changed

5 files changed

+5
-41
lines changed

UserManagement/src/main/java/com/hms/mangement/UserManagement/Configurations.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import javax.sql.DataSource;
77
import java.beans.PropertyVetoException;
88

9-
10-
119
@Configuration
1210
@PropertySource("classpath:application.properties")
1311
public class Configurations {
@@ -26,9 +24,6 @@ public class Configurations {
2624

2725
@Bean
2826
public DataSource datasource() throws PropertyVetoException {
29-
/*ApplicationContext context = new ClassPathXmlApplicationContext("been.xml");
30-
DataSource dataSource = (DataSource) context.getBean("dataSource");
31-
return dataSource;*/
3227
System.out.println("hello"+dbPassword);
3328
return DataSourceBuilder
3429
.create()
@@ -41,12 +36,14 @@ public DataSource datasource() throws PropertyVetoException {
4136

4237
@Bean
4338
public JdbcTemplate jdbcTemplate(){
39+
4440
try {
4541
return new JdbcTemplate(datasource());
4642
} catch (PropertyVetoException e) {
4743
e.printStackTrace();
4844
return null;
4945
}
46+
5047
}
5148
@Bean
5249
public UserDAOClass userDAO(){

UserManagement/src/main/java/com/hms/mangement/UserManagement/Controller.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package com.hms.mangement.UserManagement;
2-
32
import com.google.gson.Gson;
43
import org.springframework.context.ApplicationContext;
54
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
6-
import org.springframework.context.support.ClassPathXmlApplicationContext;
75
import org.springframework.web.bind.annotation.*;
8-
96
import java.util.List;
107

118
@RestController
@@ -14,7 +11,6 @@ public class Controller {
1411
private ApplicationContext context;
1512
private UserDAO userJDBCTemplate;
1613

17-
1814
public Controller() {
1915
this.context = new AnnotationConfigApplicationContext(Configurations.class);
2016
this.userJDBCTemplate = context.getBean(UserDAO.class);
@@ -23,7 +19,6 @@ public Controller() {
2319

2420
@GetMapping(value = "/Users")
2521
public String viewUsers() {
26-
System.out.println("hello get");
2722

2823
List<User> users = userJDBCTemplate.viewAllUsers();
2924
if (users != null) {

UserManagement/src/main/java/com/hms/mangement/UserManagement/UserDAO.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,11 @@
55

66
public interface UserDAO {
77

8-
9-
//public void setDataSource(DataSource ds);
10-
11-
/**
12-
* This is the method to be used to create
13-
* a record in the User table.
14-
*/
158
public void create(User user);
169

1710
public String updatePassword(int UserId, String oldPassword, String newPassword);
1811

1912
public String deleteUser(int id);
2013

21-
/**
22-
* This is the method to be used to list down
23-
* all the records from the User table.
24-
*/
2514
public List<User> viewAllUsers();
2615
}

UserManagement/src/main/java/com/hms/mangement/UserManagement/UserDAOClass.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,14 @@
77
public class UserDAOClass implements UserDAO {
88
@Autowired
99
private JdbcTemplate jdbcTemplate;
10-
// private DataSource dataSource;
1110

12-
/*
13-
14-
@Override
15-
public void setDataSource(DataSource ds) {
16-
this.dataSource = ds;
17-
18-
}
19-
*/
2011
public JdbcTemplate getJdbcTemplate() {
12+
2113
return jdbcTemplate;
2214
}
2315

24-
25-
2616
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
17+
2718
this.jdbcTemplate = jdbcTemplate;
2819
}
2920

@@ -34,8 +25,6 @@ public void create(User user) {
3425

3526
}
3627

37-
38-
3928
@Override
4029
public String deleteUser(int id) {
4130
User user = isIdExist(id);

UserManagement/src/main/java/com/hms/mangement/UserManagement/UserManagementApplication.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
package com.hms.mangement.UserManagement;
22

3-
import org.springframework.beans.factory.annotation.Value;
43
import org.springframework.boot.SpringApplication;
5-
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
64
import org.springframework.boot.autoconfigure.SpringBootApplication;
7-
import org.springframework.context.ApplicationContext;
8-
import org.springframework.context.support.ClassPathXmlApplicationContext;
95

106
@SpringBootApplication
117
public class UserManagementApplication {
12-
13-
14-
public static void main(String[] args) {
8+
public static void main(String[] args) {
159
SpringApplication.run(UserManagementApplication.class, args);
1610

1711
}

0 commit comments

Comments
 (0)