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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>User Registration</title> | |
| <link | |
| href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" | |
| rel="stylesheet" | |
| integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" |
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
| FROM maven:3.8.5-openjdk-17 AS build | |
| COPY . . | |
| RUN mvn clean package -DskipTests | |
| FROM openjdk:17.0.1-jdk-slim | |
| COPY --from=build /target/managment-0.0.1-SNAPSHOT.jar demo.jar | |
| EXPOSE 8080 | |
| ENTRYPOINT ["java","-jar","demo.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
| package controller; | |
| import config.BeanConfiguration; | |
| import dto.CustomerDto; | |
| import dto.EmiDto; | |
| import entity.Customer; | |
| import org.springframework.context.ApplicationContext; | |
| import org.springframework.context.annotation.AnnotationConfigApplicationContext; | |
| import org.springframework.stereotype.Controller; | |
| import org.springframework.ui.Model; |
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
| @Component | |
| @RequiredArgsConstructor | |
| public class JwtAuthenticationFilter extends OncePerRequestFilter { | |
| private final JwtService jwtService; | |
| private final UserDetailsService userInfoDetailService; | |
| private final TokenRepository tokenRepository; | |
| @Override |
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
| public class ServerInitalization extends AbstractAnnotationConfigDispatcherServletInitializer { | |
| @Override | |
| protected Class<?>[] getRootConfigClasses() { | |
| return null; | |
| } | |
| @Override | |
| protected Class<?>[] getServletConfigClasses() { | |
| return new Class[] {SpringConfiguration.class}; |
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
| public class LoggerFilter extends OncePerRequestFilter { | |
| private static final Logger log = LogManager.getLogger(LoggerFilter.class); | |
| @Override | |
| protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) | |
| throws ServletException, IOException { | |
| Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | |
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
| @Configuration | |
| @EnableWebMvc | |
| @ComponentScan("com.spring") | |
| @PropertySource("classpath:dbconfig.properties") | |
| public class AppConfiguration implements WebMvcConfigurer { | |
| @Autowired | |
| private Environment env; | |
| // front page location |
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
| /* | |
| * add logging.config=classpath:log4j2.xml to properties file | |
| */ | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Configuration status="WARN"> | |
| <Properties> | |
| <Property name="filename">./src/main/logs</Property> | |
| </Properties> | |
| <Appenders> | |
| <RollingFile name="file" fileName="${filename}/my-logs.log" filePattern="${filename}/my-logs-%d{HH-mm-ss-SSS}.log"> |
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
| @Endpoint | |
| public class ArticleEndpoint { | |
| private static final String NAMESPACE_URI = "http://www.concretepage.com/article-ws"; | |
| @Autowired | |
| private IArticleService articleService; | |
| @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getArticleByIdRequest") | |
| @ResponsePayload | |
| public GetArticleByIdResponse getArticle(@RequestPayload GetArticleByIdRequest request) { | |
| GetArticleByIdResponse response = new GetArticleByIdResponse(); |
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
| /* | |
| * Formatter helps parse the string to convert in java object and vice-versa | |
| * Formatters in Spring are used for formatting fields when displaying them in views or when binding request parameters. | |
| */ | |
| // create a configuration and implement WebWvcConfigurer and overrid addFormatter | |
| // create -> new LocalDateFormatter() | |
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |
| @Configuration | |
| public class AppConfiguration implements WebMvcConfigurer { |
NewerOlder