-
Notifications
You must be signed in to change notification settings - Fork 885
Refactoring & Dockerizing #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c17d3b8
feat: lombok adaptation & refactoring
ramazansakin 474467f
chore: username is already unique and not-blank, so its enough to check
ramazansakin cc2ecd5
chore: clean up
ramazansakin 0950cdd
refact: clean up
ramazansakin 3582edc
feat: app dockerized & composed with mysql
ramazansakin 523f6ec
feat: docker profile props added
ramazansakin 8d5e03c
feat: docker profile removed
ramazansakin 519f3fa
feat: docker-compose & props up
ramazansakin d710e94
get current changes & resolve conflicts
tienbku 969039d
userSSL is removed not to get connection problem but it needs to be c...
ramazansakin 5f6d3c4
SignupRequest required fields defined
ramazansakin 5f2ae8c
pre-defined roles initialized not to get "Role not found" error
ramazansakin a0c2e70
docker-compose up & lombok dep added
ramazansakin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM openjdk:8-alpine | ||
MAINTAINER "Ramazan Sakin" | ||
ADD target/spring-boot-security-jwt-0.0.1-SNAPSHOT.jar spring-boot-security-jwt-0.0.1-SNAPSHOT.jar | ||
EXPOSE 8080 | ||
ENTRYPOINT ["java", "-jar", "spring-boot-security-jwt-0.0.1-SNAPSHOT.jar"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
docker-compose.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: "2.1" | ||
services: | ||
spring-boot-jwt-auth: | ||
build: . | ||
image: spring-boot-jwt-auth | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- spring.datasource.url=jdbc:mysql://mysqldb:3306/testdb | ||
depends_on: | ||
mysqldb: | ||
condition: service_healthy | ||
restart: on-failure | ||
|
||
mysqldb: | ||
image: mysql:8.0.32 | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=123456 | ||
- MYSQL_DATABASE=testdb | ||
- MYSQL_PASSWORD=123456 | ||
restart: unless-stopped | ||
healthcheck: | ||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] | ||
timeout: 10s | ||
retries: 5 |
File renamed without changes
File renamed without changes
File renamed without changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 26 additions & 4 deletions
src/main/java/com/bezkoder/springjwt/SpringBootSecurityJwtApplication.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
package com.bezkoder.springjwt; | ||
|
||
import com.bezkoder.springjwt.models.ERole; | ||
import com.bezkoder.springjwt.models.Role; | ||
import com.bezkoder.springjwt.repository.RoleRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
import javax.annotation.PostConstruct; | ||
import java.util.Optional; | ||
|
||
@SpringBootApplication | ||
public class SpringBootSecurityJwtApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(SpringBootSecurityJwtApplication.class, args); | ||
} | ||
@Autowired | ||
private RoleRepository roleRepository; | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(SpringBootSecurityJwtApplication.class, args); | ||
} | ||
|
||
} | ||
@PostConstruct | ||
public void init() { | ||
// Create roles if they don't exist | ||
for (ERole role : ERole.values()) { | ||
Optional<Role> optionalRole = roleRepository.findByName(role); | ||
if (!optionalRole.isPresent()) { | ||
Role newRole = new Role(); | ||
newRole.setName(role); | ||
roleRepository.save(newRole); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.