June 27, 2022

Sources must not be empty | java.lang.IllegalArgumentException | Spring boot application

Issue reported


2022-06-27 16:13:04.789  INFO 6348 --- [           main] o.s.boot.SpringApplication               : Starting SpringApplication v2.6.0 using Java 11.0.7 on apple-pc with PID 6348 (E:\Aswathi\maven_repo\org\springframework\boot\spring-boot\2.6.0\spring-boot-2.6.0.jar started by aswathi in E:\Aswathi\repo\stockmaster\nyseticker)
2022-06-27 16:13:04.793  INFO 6348 --- [           main] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default
2022-06-27 16:13:04.828 ERROR 6348 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalArgumentException: Sources must not be empty
at org.springframework.util.Assert.notEmpty(Assert.java:470) ~[spring-core-5.3.13.jar:5.3.13]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:403) ~[spring-boot-2.6.0.jar:2.6.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:301) ~[spring-boot-2.6.0.jar:2.6.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.0.jar:2.6.0]
at org.springframework.boot.SpringApplication.main(SpringApplication.java:1317) ~[spring-boot-2.6.0.jar:2.6.0]

Solution

Go to class where you have your @SpringBootApplication and right click -> run as java application.



  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.6.0)

2022-06-27 16:19:32.454  INFO 3160 --- [           main] c.p.nyseticker.NysetickerApplication     : Starting NysetickerApplication using Java 11.0.7 on apple-pc with PID 3160 (E:\Aswathi\repo\stockmaster\nyseticker\target\classes started by apple in E:\Aswathi\repo\stockmaster\nyseticker)
2022-06-27 16:19:32.460  INFO 3160 --- [           main] c.p.nyseticker.NysetickerApplication     : No active profile set, falling back to default profiles: default
2022-06-27 16:19:34.141  INFO 3160 --- [           main] c.p.nyseticker.NysetickerApplication     : Started NysetickerApplication in 2.955 seconds (JVM running for 4.258)



June 21, 2022

How to use function interface in your application | simple example for lamba expression | Interview questions

Created a simple functional Interface

/**
 * @author Stock market swing trad
 *
 */
@functionInterface
public interface InitialStatus {
public String set();

}


Implementing the function Interface


    InitialValue soldCountInitialValue = () -> Long.valueOf(0);
    InitialValue quantityInitialValue = () -> Long.valueOf(0);
    InitialValue taxInitialValue = () -> Long.valueOf(5);
    InitialValue ratingInitialValue = () -> Long.valueOf(1);
    InitialValue ratingInitialCount = () -> Long.valueOf(1);


Using the variables

itemObj.setSoldCount(soldCountInitialValue.set());

Facebook comments