Skip to content

Commit 9be5116

Browse files
Denis RosaDenis Rosa
authored andcommitted
fixes
1 parent dd2de49 commit 9be5116

File tree

15 files changed

+116
-104
lines changed

15 files changed

+116
-104
lines changed

pom.xml

Lines changed: 36 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>2.4.5</version>
9+
<version>2.4.6</version>
1010
</parent>
1111

1212
<groupId>org.couchbase</groupId>
@@ -25,69 +25,62 @@
2525
<springweb.version>3.0.0</springweb.version>
2626
<couchbase.version>3.1.5</couchbase.version>
2727
<couchbaseEncryption.version>3.0.0</couchbaseEncryption.version>
28-
<springvault.version>2.2.3.RELEASE</springvault.version>
2928
<junit.version>4.13.1</junit.version>
30-
<reactivex.version>1.2.1</reactivex.version>
3129
<mavensurefire.version>3.0.0-M5</mavensurefire.version>
3230
</properties>
3331

3432
<dependencies>
35-
<dependency>
36-
<groupId>org.springframework.boot</groupId>
37-
<artifactId>spring-boot</artifactId>
38-
<version>${springboot.version}</version>
39-
</dependency>
40-
<dependency>
41-
<groupId>org.springframework.boot</groupId>
42-
<artifactId>spring-boot-starter-web</artifactId>
43-
</dependency>
44-
<dependency>
45-
<groupId>org.springframework.boot</groupId>
46-
<artifactId>spring-boot-starter-security</artifactId>
47-
</dependency>
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.springframework.boot</groupId>
39+
<artifactId>spring-boot-starter-web</artifactId>
40+
</dependency>
41+
42+
<dependency>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-devtools</artifactId>
45+
<scope>runtime</scope>
46+
<optional>true</optional>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-starter-test</artifactId>
51+
<scope>test</scope>
52+
</dependency>
4853
<dependency>
4954
<groupId>org.springframework.boot</groupId>
5055
<artifactId>spring-boot-starter-test</artifactId>
5156
<scope>test</scope>
5257
</dependency>
53-
<dependency>
54-
<groupId>org.springframework.boot</groupId>
55-
<artifactId>spring-boot-starter-webflux</artifactId>
56-
</dependency>
57-
<dependency>
58-
<groupId>org.springframework.vault</groupId>
59-
<artifactId>spring-vault-core</artifactId>
60-
<version>${springvault.version}</version>
61-
</dependency>
62-
<dependency>
63-
<groupId>org.springframework.boot</groupId>
64-
<artifactId>spring-boot-configuration-processor</artifactId>
65-
<optional>true</optional>
66-
</dependency>
6758

59+
<!-- <dependency>-->
60+
<!-- <groupId>io.springfox</groupId>-->
61+
<!-- <artifactId>springfox-boot-starter</artifactId>-->
62+
<!-- <version>${swagger.version}</version>-->
63+
<!-- </dependency>-->
64+
<!-- <dependency>-->
65+
<!-- <groupId>io.springfox</groupId>-->
66+
<!-- <artifactId>springfox-spring-web</artifactId>-->
67+
<!-- <version>${springweb.version}</version>-->
68+
<!-- </dependency>-->
6869
<dependency>
6970
<groupId>io.springfox</groupId>
70-
<artifactId>springfox-boot-starter</artifactId>
71-
<version>${swagger.version}</version>
72-
</dependency>
73-
<dependency>
74-
<groupId>io.springfox</groupId>
75-
<artifactId>springfox-spring-web</artifactId>
76-
<version>${springweb.version}</version>
71+
<artifactId>springfox-swagger2</artifactId>
72+
<version>2.9.2</version>
7773
</dependency>
7874
<dependency>
7975
<groupId>io.springfox</groupId>
80-
<artifactId>springfox-swagger2</artifactId>
81-
<version>${swagger.version}</version>
82-
<scope>compile</scope>
76+
<artifactId>springfox-boot-starter</artifactId>
77+
<version>3.0.0</version>
8378
</dependency>
8479
<dependency>
8580
<groupId>io.springfox</groupId>
8681
<artifactId>springfox-swagger-ui</artifactId>
87-
<version>${swagger.version}</version>
88-
<scope>compile</scope>
82+
<version>2.9.2</version>
8983
</dependency>
90-
9184
<dependency>
9285
<groupId>com.couchbase.client</groupId>
9386
<artifactId>java-client</artifactId>
@@ -111,23 +104,9 @@
111104
<artifactId>junit-vintage-engine</artifactId>
112105
<scope>test</scope>
113106
</dependency>
114-
<dependency>
115-
<groupId>io.reactivex</groupId>
116-
<artifactId>rxjava-reactive-streams</artifactId>
117-
<version>${reactivex.version}</version>
118-
<scope>test</scope>
119-
</dependency>
120107
</dependencies>
121108

122109
<build>
123-
<resources>
124-
<resource>
125-
<directory>src/main/resources</directory>
126-
<includes>
127-
<include>*.properties</include>
128-
</includes>
129-
</resource>
130-
</resources>
131110
<plugins>
132111
<plugin>
133112
<groupId>org.springframework.boot</groupId>

src/main/java/org/couchbase/quickstart/Application.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
package org.couchbase.quickstart;
22

3-
import org.couchbase.quickstart.runners.DBSetupRunner;
4-
import org.springframework.beans.factory.annotation.Autowired;
53
import org.springframework.boot.SpringApplication;
64
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
75
import org.springframework.boot.autoconfigure.SpringBootApplication;
86
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
97

10-
118
@SpringBootApplication(exclude = SecurityAutoConfiguration.class, proxyBeanMethods = false)
129
public class Application {
1310

14-
@Autowired
15-
private DBSetupRunner helper;
16-
1711
public static void main(String[] args) {
1812
SpringApplication.run(Application.class, args);
1913
}

src/main/java/org/couchbase/quickstart/configs/Swagger.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.couchbase.quickstart.configs;
22

33
import org.couchbase.quickstart.Application;
4+
import org.couchbase.quickstart.controllers.ProfileController;
45
import org.springframework.context.annotation.Bean;
56
import org.springframework.context.annotation.Configuration;
67

@@ -16,7 +17,7 @@ public class Swagger {
1617
public Docket api() {
1718
return new Docket(DocumentationType.SWAGGER_2)
1819
.select()
19-
.apis(RequestHandlerSelectors.basePackage(Application.class.getPackage().getName()))
20+
.apis(RequestHandlerSelectors.basePackage(ProfileController.class.getPackage().getName()))
2021
.paths(PathSelectors.any())
2122
.build();
2223
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.couchbase.quickstart.controllers;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.web.bind.annotation.RequestMapping;
5+
import org.springframework.web.servlet.ModelAndView;
6+
7+
8+
@Controller
9+
10+
public class IndexController {
11+
12+
@RequestMapping("/")
13+
public ModelAndView index() {
14+
return new ModelAndView("redirect:/swagger-ui/");
15+
}
16+
}

src/main/java/org/couchbase/quickstart/models/Profile.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package org.couchbase.quickstart.models;
22

3-
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
4-
5-
import java.util.UUID;
6-
73
public class Profile {
84
private String pid;
95
private String firstName, lastName, email, password;
@@ -22,7 +18,7 @@ public class Profile {
2218

2319
public String getPassword() { return password; }
2420
public void setPassword(String password) {
25-
this.password = getEncryptedPassword(password);
21+
this.password = password;
2622
}
2723

2824
public Profile() { }
@@ -43,13 +39,4 @@ public Profile(Profile profile) {
4339
this.password = profile.getPassword();
4440
}
4541

46-
//simple encoding to encrypt the password using BCrypt
47-
//for a more robust way to encrypt passwords, see documentation:
48-
//https://docs.couchbase.com/java-sdk/current/concept-docs/encryption.html
49-
private String getEncryptedPassword(String decryptedPassword){
50-
//note to see if the password matches the encrypted password you can use the
51-
//encoder.matches method
52-
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
53-
return encoder.encode(decryptedPassword);
54-
}
5542
}

src/main/java/org/couchbase/quickstart/runners/DBSetupRunner.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ public class DBSetupRunner implements CommandLineRunner {
2929

3030
@Override
3131
public void run(String... args) {
32-
33-
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
34-
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
35-
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
36-
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
37-
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
38-
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
3932
try {
4033
cluster.queryIndexes().createPrimaryIndex(props.getBucketName());
4134
} catch (Exception e) {
@@ -46,7 +39,7 @@ public void run(String... args) {
4639
try {
4740
CollectionSpec spec = CollectionSpec.create(CollectionNames.PROFILE, bucket.defaultScope().name());
4841
collectionManager.createCollection(spec);
49-
Thread.sleep(10000);
42+
Thread.sleep(15000);
5043
} catch (CollectionExistsException e){
5144
System.out.println(String.format("Collection <%s> already exists", CollectionNames.PROFILE));
5245
} catch (Exception e) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html>
2+
<head>
3+
<title>Getting Started: Serving Web Content</title>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
</head>
6+
<body>
7+
<p>Get your greeting</p>
8+
</body>
9+
</html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html>
2+
<head>
3+
<title>Getting Started: Serving Web Content</title>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
</head>
6+
<body>
7+
<p>Get your greeting</p>
8+
</body>
9+
</html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html>
2+
<head>
3+
<title>Getting Started: Serving Web Content</title>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
</head>
6+
<body>
7+
<p>Get your greeting</p>
8+
</body>
9+
</html>

src/main/resources/view/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html>
2+
<head>
3+
<title>Getting Started: Serving Web Content</title>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5+
</head>
6+
<body>
7+
<p>Get your greeting</p>
8+
</body>
9+
</html>

0 commit comments

Comments
 (0)