2021-01-16

【9个有钱人不想让你知道的秘密 | 富人会做而穷人不会做的事】

 

  1. 有钱人投资自己,穷人投资有钱人。
    有钱人 获得第一笔资金,先会把钱优先投资在 扩大自己的现有业务,从而获取更多的利润后、再用剩下的钱享受生活。
    穷人获得了一笔资金(工资),会迫不及待的消费掉(购买最新的手机),结果没剩下多少钱投资自己,更少的紧急备用金。
  2. 一个人是否有钱,看身边的朋友就知道。
    物以类聚,人以群分。
    自己常来往的 5 个 朋友,有 不好的经济状况。
    经常陷入不良经济状况的人,往往在 开源 和 节流上,做得不够好。
    简言之,就是这个人的金钱观 和 理财观 还有待改进。
    常常 和 这类人 相聚,难免会沾染。
  3. 学历并不代表一切。
    什么学位,都不能证明/代表理财能力。
    一个人的金钱观,是和学校无关。
    学校主要的功能,是为我们的社会培养更多的劳动力。
    假如仅通过学习就能成为 那 20% 的少数人,那现在从大学毕业的人那么多,早就把世界上的财富瓜分殆尽了。
    既然成功只属于少数人,那么学校所提供的大众化教育,就注定没办法满足所有人,实现财务自由的梦想。
    想要脱颖而出,就要终身学习,找到共同成长的小圈子。
    多多参加理财、商务相关的讲座论坛。
    多和拥有正向金钱观的成功者交谈。
    也可以多多关注一些理财、金融教育相关的博客专栏。
  4. 谁都可以成为下个百万富翁。
    成功的关键是你有多渴望成功,并且愿意为之付出多少努力。
    心态决定方向,行动决定你能在这个方向,走多远。
  5. 金钱不是万能的,时间才是。
    合理利用每分每秒。
    时间可以转换成,任何他们所需要的。
    你需要知识,那么就花时间学习吧。
    你需要良好的人际关系,那么就花时间去相处吧。
    你要想源源不断的复利和分红,那么就趁现在,趁时间还早,赶快做投资吧。
    只要你合理的利用时间,时间就可以帮助你实现梦想。
  6. 被让 明天 无限延期你的梦想。
    等毕业,我就开始创业。
    等公司给我涨薪了,我就去投资。
    等孩子长大了,我就能做我想做的一切。
    时机未到,永远是拖延症患者的最佳借口。
    一个人的梦想不在大,从小处做起,积少成多。
    终有一天,一个个的小成就,会串连成巨大的成功。
  7. 有钱人都有 7 个 收入来源。
    65% 的富人在赚到第一桶金之前,至少都有 3 个收入来源。
    平均而言,百万富翁会将家庭年收入的 20% 由于投资。
    无论收入多少,都可以先按比例开始投资。
  8. 打工仔永远都不会成为有钱人。
    别忘了,定义一个人是否富有,可不是简单看一个人的工资;因为一旦停止工作,那么百万年薪不过是一场空。
    简单的从现金流来看,打工者的现金流,流入的是工资;流出的是各项花销和债务:没有工资流入,一切就断了来源。

    而富人的现金流,流出情况跟打工者可能差不太多,但流入的有租赁收入Zūlìn shōurù、分红、利息、版税、等等等等。
    大部分的 流入资金都不是需要 朝九晚五工作的。

    正真判断一个人是否有钱,要看这个人拥有的资产:海外资产、房产、车产、保险、股票、基金、黄金等到。

    按照这个标准,打工者离有钱真的是太遥远了。
  9. 成功没有捷径。
    需要做好为之付出努力的决心。
    人与人的差别,就在有人只动了动嘴、而有的人却真正的付诸 (zhu) 了实践。























Prolink Mouse PMB8502

 

1st Replaced Battery AA on 20210116_pm044022
Used provided battery... forget to get time stamp.









2021-01-11

Solved for my case.

 


Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean defined in @EnableJpaRepositories declared on Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class java.lang.Object



Replace interface by remove <User>


@Repository
public interface RepoUser<User> extends JpaRepository<User, UserID> {



@Repository
public interface RepoUser extends JpaRepository<User, UserID> {






Solved: Caused by: java.lang.IllegalArgumentException: Not a managed type

Try adding All the following, In my application it is working fine with tomcat

 @EnableJpaRepositories("my.package.base.*")
 @ComponentScan(basePackages = { "my.package.base.*" })
 @EntityScan("my.package.base.*")   

I am using spring boot, and when i am using embedded tomcat it was working fine with out @EntityScan("my.package.base.*") but when I tried to deploy the app to an external tomcat I got not a managed type error for my entity.

 

 

.








2021-01-09

@RunWith(SpringRunner.class) vs @RunWith(SpringJUnit4ClassRunner.class)

 




What is the difference between SpringJUnit4ClassRunner and SpringRunner



Source URL: https://stackoverflow.com/a/50522420

.

@RunWith(SpringRunner.class) tells JUnit to run using Spring’s testing support. SpringRunner is the new name for SpringJUnit4ClassRunner, it’s just a bit easier on the eye.

SpringRunner is only available on spring-test 4.3.

SpringRunner class extends SpringJUnit4ClassRunner.

Source code of SpringRunner is

package org.springframework.test.context.junit4;

import org.junit.runners.model.InitializationError;

public final class SpringRunner extends SpringJUnit4ClassRunner {

    public SpringRunner(Class<?> clazz) throws InitializationError {
        super(clazz);
    }

}
.








Maven Parent vs Dependency

The two approaches are different, one is inheritance, and the other one is a simple dependency.

By dependency you'll only have the binary transitive dependencies of the project B.

By using as a parent project you'll inherit the configurations like plugins, building model, repositories, dependency-management, dependencies and so on, it depends on the case.

My rule of thumb is for scm configuration, project configuration, and development or company standards, I use a parent project (inheritance).

.

@SpringBootTest vs @DataJpaTest vs @WebMvcTest

 
In Short

  • @SpringBootTest loads full application context, exactly like how you start a Spring container when you run your Spring Boot application.

  • @WebMvcTest loads only the web layer, which includes security, filter, interceptors, etc for handling request/response. Typically you would write tests for methods under @Controller or @RestController.

  • @DataJpaTest loads only configuration for JPA. It uses an embedded in-memory h2 if not specified otherwise.

  • Service layer tests should ideally not have any annotations (except for ones that aid in mocking) because this is where your business logic (independent of any configurations) sits.

Regarding best practice, it's really just separation of concerns. I rarely ever used @SpringBootTest unless it's meant for some ad-hoc integration test on my local. Annotations like @WebMvcTest keep your tests more 'modularized' and slightly faster.
















2021-01-08

JUnit5 @RunWith

 

In JUnit 5, the @RunWith annotation has been replaced by the more powerful @ExtendWith annotation.




.

4. Migrating from a JUnit4-Based Runner 

Let's now migrate a test that uses a JUnit4-based runner to JUnit5.

We're going to use a Spring test as an example:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { SpringTestConfiguration.class })
public class GreetingsSpringTest {
    // ...
}

If we want to migrate this test to JUnit5 we need to replace the @RunWith annotation with the new @ExtendWith:

@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = { SpringTestConfiguration.class })
public class GreetingsSpringTest {
    // ...
}

The SpringExtension class is provided by Spring 5 and integrates the Spring TestContext Framework into JUnit 5. The @ExtendWith annotation accepts any class that implements the Extension interface.

.

In Short: What's JUnit 5

 
Source URL: https://stackoverflow.com/a/58384499

JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage




Source URL: https://junit.org/junit5/docs/current/user-guide/#overview-what-is-junit-5

.
JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage

The JUnit Platform serves as a foundation for launching testing frameworks on the JVM. It also defines the TestEngine API for developing a testing framework that runs on the platform. Furthermore, the platform provides a Console Launcher to launch the platform from the command line and a JUnit 4 based Runner for running any TestEngine on the platform in a JUnit 4 based environment. First-class support for the JUnit Platform also exists in popular IDEs (see IntelliJ IDEAEclipseNetBeans, and Visual Studio Code) and build tools (see GradleMaven, and Ant).

JUnit Jupiter is the combination of the new programming model and extension model for writing tests and extensions in JUnit 5. The Jupiter sub-project provides a TestEngine for running Jupiter based tests on the platform.

JUnit Vintage provides a TestEngine for running JUnit 3 and JUnit 4 based tests on the platform.

Video Briefing



What's JUnit Platform?
You only need the launcher when you want to start a JUnit platform run programmatically, i.e. outside an IDE, build tool or console runner.

In other words: the launcher is the API being used by IDEs and build tools






2021-01-07

Best Practice: com.fasterxml.jackson.databind.ObjectMapper.ObjectMapper()


private static final ObjectMapper jsonMapper = new ObjectMapper();

Constructing an ObjectMapper instance is a relatively expensive operation, so it's recommended to create one object and reuse it. You did it right making it final.

// Suggestion 1:
public static <T> T toObject1(final Class<T> type, final String json) throws IOException {
    return jsonMapper.readValue(json, type);
}

You always read JSON to a POJO, so let's be precise and clear, and use ObjectReader.

// Suggestion 2:
public static <T> T toObject2(final Class<T> type, final String json) throws IOException {
    return jsonMapper.readerFor(type).readValue(json);
}

// Suggestion 3:
public static <T> T toObject3(final Class<T> type, final String json) throws IOException {
    return jsonReader.forType(type).readValue(json);
}

There is no difference, really. Both methods will construct a new ObjectReader object: the former (jsonMapper.readerFor(type)) will give you a fully-built instance directly, the latter (jsonReader.forType(type)) will complement the not-yet-usable jsonReader and returns a ready-to-use object. I would rather go with option 2 because I don't want to keep that field.

You shouldn't worry about performance or thread-safety. Even though creating an ObjectMapper might be costly (or making a copy out of it), getting and working with ObjectReaders is lightweight and completely thread-safe.

From the Java documentation (emphasis mine):

Uses "mutant factory" pattern so that instances are immutable (and thus fully thread-safe with no external synchronization); new instances are constructed for different configurations. Instances are initially constructed by ObjectMapper and can be reused, shared, cached; both because of thread-safety and because instances are relatively light-weight.

I recently had these questions myself and decided on ObjectMapper#reader(InjectableValues) as a factory method. It's very handy particularly when you want to customise an ObjectReader slightly or, as it was in my case, to adjust a DeserializationContext.

That's an excellent question, by the way.

  improve this answer   





Google Referrals