This file contains 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 ubuntu:latest | |
RUN apt-get install -y language-pack-ja-base language-pack-ja | |
update-locale LANG=ja_JP.UTF-8 LANGUAGE=”ja_JP:ja” | |
# for Java | |
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle | |
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \ | |
apt-get update && \ |
This file contains 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 javaPractice.thread; | |
class MultiThread { | |
public static void main(String args[]) { | |
new MyThread("One"); | |
new MyThread("Two"); | |
new MyThread("Three"); | |
try { | |
Thread.sleep(10000); |
This file contains 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
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.LinkedBlockingQueue; | |
import java.util.concurrent.ThreadPoolExecutor; | |
import java.util.concurrent.TimeUnit; |
This file contains 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
import java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.LinkedBlockingQueue; | |
import java.util.concurrent.ThreadPoolExecutor; | |
import java.util.concurrent.TimeUnit; | |
public class FuturesA { | |
public static void run() throws Exception { |
This file contains 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 ObservablesRun { | |
public static void main(String[] args) { | |
List<String> symbols = Arrays.asList("GOOG", "AAPL", "MSFT", "INTC"); | |
Observable<StockInfo> feed = StockServer.getFeeed(symbols); | |
Disposable subscribe = feed.subscribeWith(new DisposableObserver<StockInfo>() { | |
int count = 0; |
This file contains 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 javaPractice.jdbc; | |
//Import required packages | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
public class JdbcExample { |
This file contains 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
@Controller | |
public class BlogController { | |
private static final String BLOG_IMAGES = "blogImages"; | |
private static final String TOMCAT_HOME_PROPERTY = "catalina.home"; | |
private static final String TOMCAT_HOME_PATH = System.getProperty(TOMCAT_HOME_PROPERTY); | |
private static final String BLOG_IMAGES_PATH = TOMCAT_HOME_PATH + File.separator + BLOG_IMAGES; | |
private static final File BLOG_IMAGES_DIR = new File(BLOG_IMAGES_PATH); | |
private static final String BLOG_IMAGES_DIR_ABSOLUTE_PATH = BLOG_IMAGES_DIR.getAbsolutePath() + File.separator; |
This file contains 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
@Service | |
public class BlogPostServiceImpl implements BlogPostService { | |
@Autowired | |
private UserService userService; | |
@Autowired | |
private BlogPostRepository blogPostRepository; | |
@Autowired |
This file contains 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 | |
public class WebMvcConfig implements WebMvcConfigurer { | |
@Bean | |
public ConfigurableServletWebServerFactory webServerFactory() { | |
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); | |
tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> { | |
// configure maxSwallowSize |
This file contains 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
@Target({TYPE,ANNOTATION_TYPE}) | |
@Retention(RUNTIME) | |
@Constraint(validatedBy = ContentTypeMultipartFileValidator.class) | |
@Documented | |
public @interface ContentType { | |
String message() default "Please upload jpg, png or gif and less than 5MB in size"; | |
Class<?>[] groups() default {}; | |
OlderNewer