Skip to content

Instantly share code, notes, and snippets.

@MasatoshiTada
Created January 19, 2020 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasatoshiTada/5bff7b8a191ff82e7c48fd4bd54ed954 to your computer and use it in GitHub Desktop.
Save MasatoshiTada/5bff7b8a191ff82e7c48fd4bd54ed954 to your computer and use it in GitHub Desktop.
package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
ApplicationContext context = SpringApplication.run(DemoApplication.class, args);
HogeService hogeService = context.getBean(HogeService.class);
}
}
package com.example.demo;
import org.springframework.stereotype.Repository;
@Repository
public class HogeDao {
}
package com.example.demo;
import org.springframework.stereotype.Service;
@Service
public class HogeService {
private HogeDao hogeDao;
// 引数あり、public
public HogeService(HogeDao hogeDao) {
System.out.println("引数ありコンストラクタが呼ばれました。");
this.hogeDao = hogeDao;
}
// 引数なし、パッケージプライベート
HogeService() {
System.out.println("引数なしコンストラクタが呼ばれました。");
}
}
/Users/tada/.sdkman/candidates/java/11.0.5.hs-adpt/bin/java -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:/Users/tada/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-1/192.7142.36/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=49757:/Users/tada/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-1/192.7142.36/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Users/tada/github/demo/target/classes:/Users/tada/.m2/repository/org/springframework/boot/spring-boot-starter/2.2.3.RELEASE/spring-boot-starter-2.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/springframework/boot/spring-boot/2.2.3.RELEASE/spring-boot-2.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/springframework/spring-context/5.2.3.RELEASE/spring-context-5.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/springframework/spring-aop/5.2.3.RELEASE/spring-aop-5.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/springframework/spring-beans/5.2.3.RELEASE/spring-beans-5.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/springframework/spring-expression/5.2.3.RELEASE/spring-expression-5.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.2.3.RELEASE/spring-boot-autoconfigure-2.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.2.3.RELEASE/spring-boot-starter-logging-2.2.3.RELEASE.jar:/Users/tada/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/tada/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/tada/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar:/Users/tada/.m2/repository/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar:/Users/tada/.m2/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar:/Users/tada/.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/Users/tada/.m2/repository/org/springframework/spring-core/5.2.3.RELEASE/spring-core-5.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/springframework/spring-jcl/5.2.3.RELEASE/spring-jcl-5.2.3.RELEASE.jar:/Users/tada/.m2/repository/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar:/Users/tada/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar com.example.demo.DemoApplication
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.3.RELEASE)
2020-01-19 21:24:43.362 INFO 36828 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication on mbp-tada.local with PID 36828 (/Users/tada/github/demo/target/classes started by tada in /Users/tada/github/demo)
2020-01-19 21:24:43.364 INFO 36828 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
引数なしコンストラクタが呼ばれました。
2020-01-19 21:24:43.752 INFO 36828 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 0.593 seconds (JVM running for 1.297)
Process finished with exit code 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment