by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 14:54
    wilkinsona closed #22291
  • 14:54
    wilkinsona closed #22290
  • 14:54

    wilkinsona on master

    Upgrade to Gradle 6.4.1 Closes… Merge branch '2.3.x' Closes gh… (compare)

  • 14:54

    wilkinsona on 2.3.x

    Upgrade to Gradle 6.4.1 Closes… (compare)

  • 14:53
    wilkinsona milestoned #22291
  • 14:53
    wilkinsona labeled #22291
  • 14:53
    wilkinsona labeled #22291
  • 14:53
    wilkinsona opened #22291
  • 14:52
    snicoll labeled #21219
  • 14:52
    snicoll commented #21219
  • 14:49
    wilkinsona milestoned #22288
  • 14:49
    wilkinsona demilestoned #22288
  • 14:49
    wilkinsona milestoned #22290
  • 14:49
    wilkinsona labeled #22290
  • 14:49
    wilkinsona assigned #22290
  • 14:49
    wilkinsona opened #22290
  • 14:32
    wilkinsona closed #22289
  • 14:32
    wilkinsona closed #22288
  • 14:32

    wilkinsona on 2.3.x

    Extend DefaultTask rather than … (compare)

  • 14:32

    wilkinsona on master

    Extend DefaultTask rather than … Merge branch '2.3.x' Closes gh… (compare)

Sidharth-Bansal
@Sidharth-Bansal
and application.properties as

server.port=9090

## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url = jdbc:mysql://localhost:3306/user
spring.datasource.username = root
spring.datasource.password = root
## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update
application is
package com.example.springboot;

import java.util.Arrays;

import com.example.springboot.model.User;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Repository;

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
        return args -> {

            System.out.println("Let's inspect the beans provided by Spring Boot:");

            String[] beanNames = ctx.getBeanDefinitionNames();
            Arrays.sort(beanNames);
            for (String beanName : beanNames) {
                System.out.println(beanName);
            }

        };
    }

    @Repository
    public static interface UserRepository extends JpaRepository<User, Long> {
    }
}
I am just trying to create user registration API
kindly help i am stuck from two days
i tried many stack overflow
results
Sidharth-Bansal
@Sidharth-Bansal
also, i am not able to connect MySQL with spring application
please help
Andy Wilkinson
@wilkinsona
@Sidharth-Bansal The compilation error is telling you that the compiler can’t find JpaRepository. Looking at the top of your class, there is no import for JpaRepository so the compiler doesn’t know where to look. You should add the following to yourApplication.java file:
import org.springframework.data.jpa.repository.JpaRepository;
Knut Schleßelmann
@kschlesselmann
@Sidharth-Bansal Word of advice: Get an IDE like Intellij IDEA. It will point out those errors immediately and will provide suggestions on how to fix this.
Andy Wilkinson
@wilkinsona
I think someone else already pointed out the problem with mvn spring-boot run a few days ago. The command should be mvn spring-boot:run. Note the : between spring-boot and run.
Sidharth-Bansal
@Sidharth-Bansal
[ERROR] Errors:
[ERROR]   ApplicationTests » IllegalState Found multiple @SpringBootConfiguration annota...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  20.935 s
[INFO] Finished at: 2020-07-07T12:04:12+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project spring-boot: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/gameskraft/Documents/FINAL/spring-boot/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
now this error is coming
@kschlesselmann I have intellij but it is my first time using it
so not able to use it fully
I have not written any JUnit tests so why is it running tests?
Torsten Liermann
@torsten-liermann
@Sidharth-Bansal Every beginning is difficult. Hold on! As I wrote to you a few days ago: If you check the application.properties and create the database by hand (create database ...), your example will work. I tried it myself. Then learn to work with an IDE and try to understand the example etc. Find a colleague to learn together, e.g. on udemy, present your experiments on github ....
Sidharth-Bansal
@Sidharth-Bansal
ok
I created the database but it is linking together don't know why
Andy Wilkinson
@wilkinsona
@Sidharth-Bansal If you used start.spring.io to create the project, it will have generated a single test to make sure that your application starts up. I would guess that it is that test that is failing.
Torsten Liermann
@torsten-liermann
@Sidharth-Bansal all information about the database connection can be found in the file application.properties if a setting is incorrect, e.g. because you chose a different name for the database, the application will not be able to connect to the database.
Ares Yang
@Marsyyh

for those who have trouble similar to my issue. Springboot @ConfigurationProperties has an issue with property class with getXXX() method.

for example

package gradle.springboot;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties("tester")
@Data
public class Tester {

    private String topic;

    private String name;

    private String group;

    public void getAll() {
        System.out.println(this.topic + this.name + this.group);
    }
}

this will result with Reason: Failed to bind properties under 'tester' to gradle.springboot.Tester, however if I change to public void all() method, it works

1 reply
Springboot version 2.3.1.RELEASE
Alessandro Vermeulen
@spockz

Is there a way to override the proxyBeanMethods property on a configuration? I'm getting

@Configuration classes need to be marked as proxyBeanMethods=false. Found: [org.springframework.scheduling.annotation.ProxyAsyncConfiguration]

Sidharth-Bansal
@Sidharth-Bansal
Hi @torsten-liermann the code which i sent today is not as per yesterday's repository link. I was creating repo on my own
Sidharth-Bansal
@Sidharth-Bansal
Thanks for the help all of you
cisco92
@cisco92
Hello :)
I'm trying to run a quite long curl request via processBuilder in SpringBoot, however I'm not sure how to format the processBuilder.command for a long and several rows long curl request with header and body. Currently I'm only getting a 404 bad request.. Can someone help me how to format something like this:
```

        processBuilder.command("curl",  "-X", "POST",  "https://***** \\" +
                "--header 'SOAPAction: \"Retrieve\"' \\" +
                "--header 'Content-Type: text/xml;charset=UTF-8' \\" +
                "--data-raw '<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"> \\" +
                "    <SOAP-ENV:Header> \\" +
                "        <SOAP-ENV:fueloauth>*************</SOAP-ENV:fueloauth> \\" +
                "    </SOAP-ENV:Header> \\" +
                "    <SOAP-ENV:Body> \\" +
                "        <ns2:RetrieveRequestMsg xmlns:ns2=\"http://exacttarget.com/wsdl/partnerAPI\"> \\" +
                "            <ns2:RetrieveRequest> \\" +
                "                <ns2:ObjectType>AutomationInstance</ns2:ObjectType> \\" +
                "                <ns2:Properties>Name</ns2:Properties> \\" +
                "                <ns2:Properties>StartTime</ns2:Properties> \\" +
                "                <ns2:Properties>CompletedTime</ns2:Properties> \\" +
                "                <ns2:Properties>Status</ns2:Properties> \\" +
                "                <ns2:Filter xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ns2:SimpleFilterPart\"> \\" +
                "                    <ns2:Property>CustomerKey</ns2:Property> \\" +
                "                    <ns2:SimpleOperator>equals</ns2:SimpleOperator> \\" +
                "                    <ns2:Value>b9d4a27c-9011-0d33-65f9-61fac7e93f2e</ns2:Value> \\" +
                "                </ns2:Filter> \\" +
                "            </ns2:RetrieveRequest> \\" +
                "        </ns2:RetrieveRequestMsg> \\" +
                "    </SOAP-ENV:Body> \\" +
                "</SOAP-ENV:Envelope>'");
boristhecat
@boristhecat
Hi there, i am still "fighting" with the use of RSockets Channel Mode:
When i am using the RSocketRequester on my client side and use a Flux as its Payload via the .data() method, the corresponding controller method on the server seems to subscribe to this payload flux automagically. I would have expected to subscribe to the flux in the controller method myself. Is this working as intended?
kshitijbist
@kshitijbist
Hi Guys, I have a query related to the transaction in microservices. I have read that distributed transactions should be avoided. But what if I have a single service (multiple instances for scaling) that uses a single database. How can I make sure my transactions are ACID in spring.
peddi-dev
@peddi-dev
Hello Friends,
I would like to work as volunteer developer with Java/SringBoot/Microservices/ReactJS UI. Could you please advise some project (Opensource or commercial).
I had Full Stack Development Experience. I have taken career break. Now I am resuming the career. Thanks in advance.
Kim Lidström
@dxtr

Let's say I have a feign client defined like this:

@FeignClient(name = "CurrenciesAPI", url = "${endpoint.url}/currencies")
public interface CurrenciesAPI {
    @GetMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
    ApiResponse<CurrencyData> getCurrencies(@SpringQueryMap CurrenciesParams params);
}

And CurrenciesParams is defined like this:

@Value
@AllArgsConstructor
public class CurrenciesParams {
    String accessKey;
    Integer limit;
    Integer offset;
}

Can I somehow tell feign to name the accessKey parameter access_key or will I have to rename the property in the class?

Err, wrong channel perhaps
Sorry if it is
good luck
@chuzhixin

超棒的vue跨平台前端基础框架vue-admin-beautiful分享,适合学习,找工作,同时兼容手机,电脑,平板完全开源免费

演示地址:

http://chu1204505056.gitee.io/vue-admin-beautiful

演示地址2:

http://mpfhrd48.sanxing.uz7.cn/vue-admin-beautiful/

源码地址:

https://github.com/chuzhixin/vue-admin-beautiful

欢迎star

Andreas Höhmann
@ahoehma
Looks nice @chuzhixin :D
Hao de
Andreas Höhmann
@ahoehma

Hi all ... I'm facing a little problem like described here (https://stackoverflow.com/questions/37058691/encoded-comma-in-url-is-read-as-list-in-spring) - binding a list of Strings to a rest-endpoint where it must be possible to use "," in the String. Anyone here have an idea on that? Currently we are using a workaround via

@InitBinder
public void initBinder(final WebDataBinder binder) {
    // use the custom convert which does NOT convert 'A,B' to two entries.
    binder.registerCustomEditor(List.class, new CustomCollectionEditor(ArrayList.class) {
      @Override
      protected Object convertElement(final Object element) {
        // FIXME sometimes we get the value not URL decoded ... no idea why, does not happen in tests
        if (element instanceof String) {
          final String value = (String) element;
          if (value.indexOf('%') > -1) {
            // should not happen..
            LOGGER.info("Must manually decode input value '{}', why?", value);
            try {
              return URLDecoder.decode(value, "UTF-8");
            } catch (final UnsupportedEncodingException e) {
              LOGGER.error("Cannot decode '{}' with UTF-8", value, e);
            }
          }
        }
        return super.convertElement(element);
      }
    });
  }

.... but this looks not right because its a global "fix". Any ideas guys?

8 replies
NicklasWallgren
@NicklasWallgren
Hey
Is it possible to limit spring.jpa.hibernate.ddl-auto=create to only run once, and not everytime the context is re-created due to for example @MockBean? I know of the "validate" option, but I'm refrained from using it due to performance penalties with up to 10-20 %.
Stéphane Nicoll
@snicoll
The context is not “re-created”. A separate context is created. Are you using an embedded database for those tests?
7 replies
Artjom Kalita
@artjomka
Hello ! I am creating my custom events which extends ApplicationEvent and I am a bit confused about source param in constructor - is it the place (this in component/service) where event being fired ?
3 replies
Eduard Iskandarov
@toidi

Hi there, I'm trying out Spring Boot 2.3.2 with kotlin coroutines.
For database communication, I use R2DBC 0.8

The problem I face is tests do not create database schema from schema.sql file

I annotate test class with @DataR2dbcTest; in application.properties I set spring.r2dbc.initialization-mode=always

What is missing?

Andy Wilkinson
@wilkinsona
@toidi There's no spring.r2dbc.initialization-mode property in Spring Boot. There may have been one in the experimental project, I can't remember. Please see this section of the documentation for details of how to initialise the database when using R2DBC.
2 replies
good luck
@chuzhixin

超棒的vue跨平台前端基础框架vue-admin-beautiful分享,适合学习,找工作,同时兼容手机,电脑,平板完全开源免费

演示地址:
http://chu1204505056.gitee.io/vue-admin-beautiful
演示地址2:
http://mpfhrd48.sanxing.uz7.cn/vue-admin-beautiful/
源码地址:
https://github.com/chuzhixin/vue-admin-beautiful
欢迎star

faguilera85
@faguilera85
hello
I'm new to spring Websocket, I want to push a message from my server to the client. I think I've got everything setup already but I don't know how to actually push the message. Am I right thinking that I have to call simpMessagingTemplate.convertAndSend("/topic/blog", message) ?