[Solved] Spring Boot external properties not loaded

If you do new Admin (), you are creating a new instance of Admin and not a spring bean. So you don’t get any advantages which spring provides(for example Dependency Injection) And hence the value is null. Instead you should Autowire it in your class. This way spring will inject the instance of Admin that … Read more

[Solved] Return link from Hateos

Based on your comments & question for migration this is what I am suggesting: Map<LinkRelation, Optional<Link>> links = new HashMap<LinkRelation, Optional<Link>>(); links.put(IanaLinkRelations.SELF, Optional.of(response.getLink(IanaLinkRelations.SELF))); links.put(IanaLinkRelations.NEXT, Optional.of(response.getLink(IanaLinkRelations.NEXT))); links.put(IanaLinkRelations.PREVIOUS, Optional.of(response.getLink(IanaLinkRelations.PREVIOUS))); …. //calling addLinlk addLink(apmCoreBaseUrl, response, links, IanaLinkRelations.SELF); addLink(apmCoreBaseUrl, response, links, IanaLinkRelations.NEXT); addLink(apmCoreBaseUrl, response, links, IanaLinkRelations.PREVIOUS); And inside addLink: private void addLink(String baseUrl, RegistrationsResource response, Map<LinkRelation, Optional> links, LinkRelation … Read more

[Solved] How to properly use findBySomeOtherId not findById in Spring data jpa?

Please use this InterviewStatus findByInterviewId(Interviews interviewId); where interviewId is gotten by running Interviews findById(Long id). Due to the datatype conflict, it is ok that you pass in as parameter the expected datatype. so it is expecting Interviews not Integer, but you have integer. in this case, you get Interviews using the integer then pass the … Read more

[Solved] Java Array.asList error

Assuming your Article class is like below if not please make proper class, class Article{ String id; String article; String description; Article(String id ,String articleName,String description) { this.id=id; this.articleName = articleName; this.description = description; } …….. //your getter/setters are defined here. } Now you should use them in your main class as below, List<Article> articleList … Read more

[Solved] @RequestMapping annotation isn’t display while using Press ‘Ctrl+Space’.No completions available.I worked on STS-3 IDE [closed]

I think your jars are not downloaded or not in build path(Maven dependencies jar in eclipse) check all of spring boot jars are downloaded and these jars are in build path.Right click on project update your maven project select offline and force update option checkbox. and also check <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.1.RELEASE</version> <relativePath /> <!– … Read more

[Solved] Can I call a .java file from a .html file with href or something else without using javascript in-between [closed]

Updated from OP comment: Thank you very much for your reply and let me correct the question can I call a function which is written in java directly from a html. – JAVA Coder Nov 5 at 9:08 Still the same answer. Methods or functions, terminology aside. What you’re proposing is like trying to power … Read more

[Solved] How to parse yyyymm data format to Month, YYYY format in Java?

I would use java.time for a task like this. You can define two java.time.format.DateTimeFormatter instances (one for parsing the input string to java.time.YearMonth and another for formatting the obtained YearMonth to a string of the desired format). Define a method like this one: public static String convert(String monthInSomeYear, Locale locale) { // create something that … Read more

[Solved] Post a image usining binairy and other data

figured it out, set image as binary in model @RequestMapping(value = “/update”, method = RequestMethod.POST, consumes = “multipart/form-data”) public ResponseEntity<Payee> update(@RequestPart(“payee”) @Valid Payee payee, @RequestPart(“file”) @Valid MultipartFile image) throws IOException { // routine to update a payee including image if (image != null) payee.setImage(new Binary(BsonBinarySubType.BINARY, image.getBytes())); Payee result = payeeRepository.save(payee); return ResponseEntity.ok().body(result); } solved Post … Read more

[Solved] Spring Security – api gateway pattern – bug?

Alright, after many hours we found a solution to what seemed to be inconsistent behavior. Meaning sometimes you’d log in and it’d retain the proper session and you could go the the localhost:8080/ui page and not get the Whitelabel Error page… sometimes you’d still get it. On the Gateway server… 1) Added RequestMethod.POST @Controller public … Read more

[Solved] How to send BufferedImage using Spring?

I don’t know your codes, because you provided none. So I’ll try to guess. It seems like you do not say to your client he will download an image. Try adding this to your response header : Content-type: image/jpeg I’ll give some example code, but I can’t promise it will work for you. @GetMapping(path = … Read more